Come for answers, stay for best practices. All we're missing is you.
Forum question posted -
Hi
Whats the proper way to set a value in an invoked bin file and use it after the file has been invoked. For example the recorded examples has workordertest.bin and callout.bin files. The workordertest one invokes the callout.bin which creates three workorders where the wonum is autogenned... I would like to bring up one of these after it has created the three - what's the proper way to get my hands on the value after callout.bin has returned? I tried making a static variable but the scope appears to be different (i.e. I made the same static in each bin expecting them to be reused but no they were separate in memory/scope)
thanks
Jeff
Hi Jeff.
There are couple of ways to do that.
1. You can create a variable before calling the invoked file (callout) and then passing the variable into the callout event. You would know the value of the record name/number before using it in the callout. This would be done using a randomly generated record name.
2. You can return the value from the callout itself. For example:
{"event":"callout","binfile":"./applications/purchase_orders/CreateNewInternalPurchaseOrder.bin","params":"true, null, Invusage PO, $storeroom, true","returnValue":"internalPO"},
The last parameter used in this event is returnValue - that takes the value returned from the callout and assigns it the variable internalPO.
To do this, the last line of the callout CreateNewInternalPurchaseOrder.bin is:
{"event":"calloutReturnValue","returnValue":"$poNum"} where $poNum is the autogenerated PO number that was retrieved earlier in the callout.
Hopefully one of these solutions helps!
Thanks,
Kristin