Hi,
. I’m reading a workorder from remedy using remedy plugin in vRO, which is successful and output is returned in var actionResult(Array/ Remedy:ITSMRecord) having key and values. Now I need key values matching the key 1000*****.in a o/p variable to pass it in workflow.
But throws error as not an array or invalid conversion
---------------------------------------------------------------------------------------------------------------------------------
System.log("Records Returned [" + actionResult.length + "]");
for(var i=0;i<actionResult.length;i++){
var f = actionResult[i].getFields();
System.log("Record contains [" + f.length + "] fields");
for(var t=0;t<f.length;t++){
System.log("\tKey [" + f[t].getKey() + "] :: Value [" + f[t].getValue() + "]");
if(f[t].getKey()=="1000*****"){
WorkOrderNumber = f[t].getValue()
}
}
}
--------------------------------------------------------------------------------------------------------
Kindly help me out fixing this
Thanks,
Manu
Hi Manu,
I don't think everyone has the ITSM plugin so it would be helpful if you share some more details:
Best regards,
Chris
Thank you, it helps a bit. I can't find an error in there. So the only thing I can imagine is:
The function getKey() doesn't return something of type string so you would need to stringify it before you can do a string comparison. You can try doing: f[t].getKey().toString()=="1000*****" in your if clause and see if this helps.
Hi Chris,
Please find the below error output. Also I tried using the getKey().toSTring() still it throws error not an array
[2017-04-26 10:52:26.943] [E] Workflow:Copy of Get Work Orders / handleResults (item2) : ch.dunes.model.type.ConvertorException: Not an Array
[2017-04-26 10:52:26.962] [E] Workfow execution stack:
***
item: 'Copy of Get Work Orders/item2', state: 'failed', business state: 'null', exception: 'Not an Array'
workflow: 'Copy of Get Work Orders' (f21923b3-244b-4203-90b0-9b0a3c5ccabc)
| 'attribute': name=actionResult type=Array/BMCRemedyITSM:RemedyRecord value=#{#BMCRemedyITSM:RemedyRecord#dunes://service.dunes.ch/CustomSDKObject?id='5b0a4928-93b0-4c56-9cc7-6ece61b8a854'&dunesName='BMCRemedyITSM:RemedyRecord'#;#BMCRemedyITSM:RemedyRecord#dunes://service.dunes.ch/CustomSDKObject?id='0af20336-0b4a-47eb-84e1-04afc815a1b8'&dunesName='BMCRemedyITSM:RemedyRecord'#;#BMCRemedyITSM:RemedyRecord#dunes://service.dunes.ch/CustomSDKObject?id='8f62b5a0-cd8a-40e8-bb8a-fda7d75baa6b'&dunesName='BMCRemedyITSM:RemedyRecord'#;#BMCRemedyITSM:RemedyRecord#dunes://service.dunes.ch/CustomSDKObject?id='cbc6edef-9474-4c14-aa57-5fadebcffea9'&dunesName='BMCRemedyITSM:RemedyRecord'#;#BMCRemedyITSM:RemedyRecord#dunes://service.dunes.ch/CustomSDKObject?id='921c5f7a-22bf-4aa3-83a5-03b22052b6e6'&dunesName='BMCRemedyITSM:RemedyRecord'#;#BMCRemedyITSM:RemedyRecord#dunes://service.dunes.ch/CustomSDKObject?id='a4d848c5-63e4-4718-9d71-30e5564224c7'&dunesName='BMCRemedyITSM:RemedyRecord'#;#BMCRemedyITSM:RemedyRecord#dunes://service.dunes.ch/CustomSDKObject?id='c32d811a-c525-492b-81f1-ded073179e7e'&dunesName='BMCRemedyITSM:RemedyRecord'#;#BMCRemedyITSM:RemedyRecord#dunes://service.dunes.ch/CustomSDKObject?id='fc5e5c37-4eef-4327-a913-2812b1ab0500'&dunesName='BMCRemedyITSM:RemedyRecord'#}#
| 'attribute': name=queryForm type=string value=WOI:WorkOrder
| 'attribute': name=errorCode type=string value=
| 'attribute': name=arserver type=BMCRemedyITSM:ARServer value=dunes://service.dunes.ch/CustomSDKObject?id=xxxxxxxxxx&dunesName='BMCRemedyITSM:ARServer'
| 'attribute': name=qualification type=string value='1000000000' = "xxxxxxxxxxxxxxxxxxxx"
| 'attribute': name=fields type=Array/string value=#{#string#1000000182#;#string#301517000#;#string#1000003302#}#
| 'attribute': name=WorkOrderNumber type=Array/string value=__NULL__
| 'attribute': name=WorkOrderNumberout type=Array/string value=__NULL__
| 'no inputs'
| 'no outputs'
*** End of execution stack.
Thanks,
Manu
If you provide sample workflow we can take a look.
but from error message I see two additional attributes expecting array of strings "Array/string"
| 'attribute': name=WorkOrderNumber type=Array/string value=__NULL__
| 'attribute': name=WorkOrderNumberout type=Array/string value=__NULL__
at the same time in provided code snippet seems like WorkOrderNumber is set to concrete value not to array
if(f[t].getKey()=="1000*****"){ WorkOrderNumber = f[t].getValue() }
I would also check if there is inptu/output binding also for them