In my SIL script, I am trying to link an issue but it is not working in my IF statement. Below is the part of my script:
if(contains(customfield_1234,"FieldName"))
{
string newKey = createIssue(key.project, "", "Task", "summary!",priority,"description","",DueDate,"",{},custom_field_mapping);
%newKey%.customfield_1234 = customfield_1234;
linkIssue(key, newKey, "Relates");
}
I think the problem is that it is trying to link an issue that technically doesn't exist since it is wrapped in an IF statement?
Jira log error:
Cannot cast string >>Project_Name<< to an issue. Invalid issue key format. Are you running the script from create screen ?
Good evening, I seem to be getting the error "else without if" when I try to design this code.
I had it working previously, but for the life of me cannot see where im going wrong here.
// Code is inside a button press actionevent
String amount = jTextFieldBlockAddAmount.getText();
String Loc = jTextFieldBlockAddLoc.getText();
if (amount.equals("") || (Loc.equals("")));
{
Component frame = null;
JOptionPane.showMessageDialog(frame, "Please fill in the two sections before adding a new block", "Insert Error", JOptionPane.ERROR_MESSAGE);
}
else {
GreBlock block = new GreBlock(new Date(), amount, Loc);
Grechain.NewBlock(block);
jTextFieldBlockAddAmount.setText("");
jTextFieldBlockAddLoc.setText("");
Component frame = null;
JOptionPane.showMessageDialog(frame, "A block has been added to the blockchain");
System.out.println("Block Successfully Added");
}
What am I missing here? if the else statement begins to work the functions within it all work fine, so there is no problem there.
Thanks in advance,
Hi @Midnite8
Try printing the new key with a runnerlog and you will see if it's creating the issue or not. You are correct with your assessment, so something happened with the create function, maybe one of the fields are missing or have not been configured.
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Interesting, I commented out the linkIssue line and it still has the same error. I checked both fields in the createIssue lines and made sure they exist in the screen associated with the IssueType.
I have a slightly different version of the script with everything the same except that I don't have any IF statements that include a linkIssue and it works.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It's actually the create function that is causing the issue. Why don't you share the whole script?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
For the runnerlog: https://confluence.cprime.io/plugins/servlet/mobile?contentId=6558203#content/view/6558203
It would be runnerLog("new issue:" + newKey);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.