How can I change the process-field in scripts?

Posted by smartsysISV on 23-Aug-2015 03:43

Both Server-side and client-side

Posted by Mohammed Siraj on 25-Aug-2015 09:51

Have reviewed this api functionality for status fields & encountered issues in some scenarios. Tracking this as Issue:PSC00339578.

Basically the scenario is, if in the edit page, user changes the Workflow Process in process field, Workflow Status field is reset with incorrect metadata. As a result, rbf_setPicklistCode API function is affected.

Can you please confirm that you are facing the issue in the same scenario. Else, please share additional details so that we can resolve them in forthcoming releases.

Also, please share Rollbase Release Version that you are on, if not a hosted clouded user.

All Replies

Posted by Mohammed Siraj on 24-Aug-2015 05:12

To update Workflow Process field, you can leverage client-side and server-side API as stated below:

Client-side:

rbf_setFieldValue('process','665937') ;

Where, 'process' is the integration name of Workflow-process field.

'665937' is the Workflow Process ID.

Server-side:

rbv_api.setFieldValue("ProcessOrder", {!id}, "process", 665937);

where "ProcessOrder" is object integration name

{!id} is object id.

'process' is process field integration name.

665937 is the  Workflow Process ID (passed as INTEGER argument) .

Posted by smartsysISV on 25-Aug-2015 03:30

But is the id the same if we install this application on other instances?

I thought we had to rely on a code?

Posted by Mohammed Siraj on 25-Aug-2015 06:01

Right, Workflow Process ID will differ when application is imported into a different tenant.

This is  a llimitation with Workflow Process as we do not assosciate a integration code with it.

Posted by smartsysISV on 25-Aug-2015 06:05

And then it is no possibility to create a code for this, without changing code on each installation?

Posted by charltonsantana1 on 25-Aug-2015 06:28

This is not an answer, this is a question similar...

How to I change the workflow status using integration name on browser side in edit view, I could use ID but this changes when moving the application from one cloud to the other. Note: I have tried both setPicklistValue and setFieldValue but both do not work..

Any suggestions?

Posted by Mohammed Siraj on 25-Aug-2015 06:51

@smartsysISV, yes, we cannot define codes for Workflow Process. Will consider revising this going forward.  Will share more details on this shortly.

Posted by Mohammed Siraj on 25-Aug-2015 06:57

@charltonsantana1, for status fields, user can define integration codes. Hence, you should leverage the same instead of ID values.

For your requirement, to set status field value via scripting in Object Edit page, use:

rbf_setPicklistCode('status','Initiated') where

'status' is field integration name

'Initiated' is integration code for the Workflow status to select.

rbf_setPicklistCode API is specifically designed to be used with integration code values for Picklist, CheckBoxesGroup & RadioButtons.

Posted by charltonsantana1 on 25-Aug-2015 08:16

@msiraj Sorry _ was meant to mention that I have used rbf_setPicklistCode('status', 'awaiting_survey_conf') and have tried this but still not working.

I have used this on many picklist's before but just can't get it to work for workflow status.

Posted by Mohammed Siraj on 25-Aug-2015 09:51

Have reviewed this api functionality for status fields & encountered issues in some scenarios. Tracking this as Issue:PSC00339578.

Basically the scenario is, if in the edit page, user changes the Workflow Process in process field, Workflow Status field is reset with incorrect metadata. As a result, rbf_setPicklistCode API function is affected.

Can you please confirm that you are facing the issue in the same scenario. Else, please share additional details so that we can resolve them in forthcoming releases.

Also, please share Rollbase Release Version that you are on, if not a hosted clouded user.

This thread is closed