I am trying to set the due date of a request to a user variable

CatchTheFletch
Tera Contributor

I am trying to set the request due_date variable to a date variable the user picks on a form. I can't seem to get it to change on submission. I setup an onsubmit script trying to change it and it didn't work. I set a run script in the workflow and it didn't work. The goal is that the task sets its due date as the request due date which should be set to what the user inputs on the form but I can't seem to get it to get that value.

Thanks in advance for any help.

 

Edit:

I guess the screenshots are broken. The run script I tried is currently this:

current.due_date = current.variables.desired_due_date;

But I have done a couple of variations with no success.

The onsubmit I tried was this:

function onSubmit() {
    //Type appropriate comment here, and begin script below
    var desired = g_form.getValue('desired_due_date');

    g_form.setValue('due_date', desired);
}

1 ACCEPTED SOLUTION

Aman Kumar S
Kilo Patron

Hey @CatchTheFletch ,

If you are trying to populate Request's due date(and not RITM), then you will need to glide the request record to update.  

Try below script in your run script activity:

var reqGR = new GlideRecord("sc_request");
reqGR.get(current.getValue("request"));
reqGR.setValue("due_date", current.variables.desired_due_date);
reqGR.update();

 

Feel free to mark correct, If I answered your query.

Will be helpful for future visitors looking for similar questions 🙂

Best Regards
Aman Kumar

View solution in original post

9 REPLIES 9

Musab Rasheed
Tera Sage
Tera Sage

Hello,

Image is broken, Can you attach image and also If you have script then paste it directly ?

Regards

Please hit like and mark my response as correct if that helps
Regards,
Musab

Edited the post if that clears things up. Thanks for letting me know. 

Check Aman's reply and see if that works

Please hit like and mark my response as correct if that helps
Regards,
Musab

Brian Lancaster
Tera Sage

An onsubmit catalog client scrip will not update field on a table. You would need to use a before insert business rule on the sc_req_item table. If this is on all catalog items no condition would be needed but if this is only on a few then you would need to create a condition of which items needs to run on.

code would be as simple as due_date = current.variables.desired_due_date;