The CreatorCon Call for Content is officially open! Get started here.

set value on requested item using catalog client script

srikanthvk
Giga Expert

Hi,

I have been trying to set a value on my requested item form through an OnSubmit catalog client script, but to my surprise i'm unable to set it.

I'm wondering what went wrong, i have also included a timer for 30 secs on the workflow which didn't give any results.

Below is the code snippet

function onSubmit() {

    //Type appropriate comment here, and begin script below

  if(g_form.getValue('var_req') != ''){

  g_form.setValue('u_input','4 hours');

  }

   

}

1 ACCEPTED SOLUTION

As stated earlier, you will not have direct access to the created item from client script. You would need to create a hidden variable, set it. Then it would get pushed into the field on the target record through naming convention.



OR, you can use the script within the catalog item definition. I posted a image of the script field. You would have access to producer variables and the current target record.


View solution in original post

12 REPLIES 12

srikanthvk
Giga Expert

Also my input to the u_input field is dependent on more than one variable for different catalog items, as my workflow is being used in more than one catalog item, i cannot either use a business rule to set value. If i have use a business rule i'll have hardcode the catalog item and check for the variable values for the respective catalog item.



Thanks,


Srikanth Varma


As stated earlier, you will not have direct access to the created item from client script. You would need to create a hidden variable, set it. Then it would get pushed into the field on the target record through naming convention.



OR, you can use the script within the catalog item definition. I posted a image of the script field. You would have access to producer variables and the current target record.


Hey Aaron,



Thanks for the idea, a hidden variable can do wonders for me. Not sure why i haven't thought of it earlier .


Now i'll use this hidden variable and write an onSubmit write, i'll also write a before BR on sc_req_item to set the variable value into the field.



Thanks a lot .