Question

Access Business Process Parameter from Script Task ?

Hi,

 

I am trying to get my Process Parameter, "ProcessSelectedSL" (Text), into a variable of my Script Task.

I tried this: 

var entities = Get<string>("ProcessSelectedSL");

but entities gets null. When I retrieve this parameter from another process elements, like "Auto-generated page", I can get it ...

Thanks

Like 0

Like

7 comments

Dear Jean,

You must have made some spelling errors in the code. Please copy the text from the code below and not type it:

get/set value in a business process script task
var parameter1 = Get&lt;Guid&gt;("Parameter1");
Set("Parameter2", parameter1.ToString());
var parameter2 = Get&lt;string&gt;("Parameter2");
 
get object of type UserConnection
var userConnection = Get&lt;UserConnection&gt;("UserConnection");

And also double check that the parameter name (not title) is entered correctly.

 

Lisa Brown,

Thanks for your answer. It seems my script wasn't correctly encoded. This problem is solved.

I just have another question, using EntitySchemaQuery to create a record with Insert, how can we easily get the created object Id ?

 

Thanks !

Jean Michou,

Please specify the record Id when you create the record. The record will be created with the specified id.

Eugene Podkovka,

Thanks for your answer Eugene.

That is a solution, but how can I get an Id to use ?

I mean, is there a way to get a random Id, not already used in a table ?

Jean Michou,

If you ask about JS, then there is no specific solutions for this in bpm'online. Please find the answer in google. For example https://stackoverflow.com/questions/105034/create-guid-uuid-in-javascri…

If you ask about c# then its Guid.NewGuid

Eugene Podkovka,

Thanks, that is what I was looking for

For reference in a client module using JavaScript you can use:

var newGuid = Terrasoft.utils.generateGUID();

That was returned by Bing GPT-4.

Show all comments