Skip to main content

I am trying to update a single attribute of all PurchaseOrderLinePart Entities linked to the PurchaseOrder the workflow runs on with a certain value (today’s date), but after reading and browsing for 2 hours i cannot find a way to do this.

It seems the Reference_PurchaseOrderLinePart API only has GET functionality.

I must be missing something obvious...

If you’re using the PurchaseOrderHandling projection, query on and update the nested entity sets LinePartArray and/or LineNoPartArray under the PurchaseOrderSet.

Or try to use the PurchaseOrderLinesHandling projection to query on and update PurchaseOrderLineSet (as long as it lets you update the field you need).

 


This is exactly what i had tried, yet the workflow throws an error, demanding a LineNo.

 


You need to read the lines first, then loop over them in a sub-process, and update one by one.

Check if you’re environment has the sample workflow LoopingDemo loaded. That’s probably better than me sending screen captures. Different entity but same principle.

 


I only have WorkTaskLoopsExample  and LoopJsonBlockExample, both of which leave me scratching my head about how the expression of the sub-process (as a while) is defined.

There doesn’t seem to be any info about this workflow on the public internet either.

Could you maybe show me how Set Description Value iterates over the Array?


I found it’s diagram File in the Documentation.

Thank you very much!

For anyone else who might need it, it’s here.


@AussieAnders it appears that the Entity is different, but also the way to query them.

After “READ”ing PurchaseOrderLineSet by OrderNo, i run an UPDATE Task, yet there are no updates to the database.

I tried updating the BuyQtyDue Field (as a test), which is visible to the Projection, yet it seems to not do the actual updating.

Here a screenshot of the debugging watch result, which seems to have correctly passed a PurchaseOrderLineSet to my Update task.

 


I adjusted the workflow to work with LinePartArray now, as it is the more direct way and i got it to work.

The problem was, that a “Validation” Workflow doesn’t seem to allow UPDATEs, as it probably reverts transactions (?).

Now the only problem i have left is how to fill a date attribute with the current time.

 

I tried &SYSDATE, NOW(), a string, a javascript variable of a new Date object, a javascript date object converted to a string and a javascript date object converted to a json object converted to a string.

 

The Error is always: class java.lang.String cannot be cast to class java.sql.Timestamp (java.lang.String is in module java.base of loader 'bootstrap'; java.sql.Timestamp is in module java.sql of loader 'platform')

 


Workflows with dates are pain, because they don’t following any standard format. I found this snippet of JavaScript in a workflow I created a while ago:

// new Date().toJSON() will return current date+time on format YYYY-MM-DDTHH:mm:ss.sssZ
// IFS wants format YYYY-MM-DD-HH.mm.ss
var trxDate = new Date().toJSON().replaceAll('T', '-').replaceAll(':', '.').substr(0, 19);
execution.setVariable('TransactionDate', trxDate);

 


It took me over an hour and an endless amount of deployments of the workflow to find the correct formatting.

Giving it a string, like you describe above was not working, as it caused the same Error to appear.

The solution that worked for me was to create an object to hand to the process directly.

var sysDate = new java.sql.Timestamp(new java.util.Date().getTime());
execution.setVariable('SYSDATE',sysDate);

 


Reply