Is it possible to auto-populate a single line text using flow design?

jeffreygard1127
Tera Contributor

Hi everyone!

 

I need help with flow and I couldn't figure out the solution.

I created a new catalog form and the form contains the following fields:

 

1. Dock # - This is a single line text. Visible on portal. Will ask users to input dock#

2. WEB URL - Also a single line text, hidden on portal but visible on the back-end. With pre-populated url.

 

What I need to do is, if user inputs a dock# on the portal, the dock# will be added on the WEB URL field (with pre-populated url). Please refer to the image below:

I need to do this  by using a flow design and without any scripting. Is it possible? Please help. Thank you.

AUTO POPULATE.png

1 ACCEPTED SOLUTION

Murthy Ch
Giga Sage

Hello @jeffreygard1127 

You can create a custom action and pass the RITM record into it like how I did in below screenshot and update the variable based on the value of the dock.

MurthyCh_0-1731361108694.png

MurthyCh_1-1731361164116.png

(function execute(inputs, outputs) {
// ... code ...
var grRITM = new GlideRecord("sc_req_item");
if(grRITM.get(inputs.ritm)){
    if(!gs.nil(grRITM.variables.dock)){
        grRITM.variables.url = "https://www.google.com" + grRITM.variables.dock.toString();
        grRITM.update();
    }
}
})(inputs, outputs);

(=tested)

Let me know if you stuck anywhere

Thanks,
Murthy

View solution in original post

8 REPLIES 8

Murthy Ch
Giga Sage

Hello @jeffreygard1127 

You can create a custom action and pass the RITM record into it like how I did in below screenshot and update the variable based on the value of the dock.

MurthyCh_0-1731361108694.png

MurthyCh_1-1731361164116.png

(function execute(inputs, outputs) {
// ... code ...
var grRITM = new GlideRecord("sc_req_item");
if(grRITM.get(inputs.ritm)){
    if(!gs.nil(grRITM.variables.dock)){
        grRITM.variables.url = "https://www.google.com" + grRITM.variables.dock.toString();
        grRITM.update();
    }
}
})(inputs, outputs);

(=tested)

Let me know if you stuck anywhere

Thanks,
Murthy

Hi @Murthy Ch, thank you for answering my question. I'm new to ServiceNow and still not very familiar with flow design but may I ask what this is and how can I create this? I'm following your solution but I'm stuck on this part. Also, I forgot to mention that this should reflect on the SCTASK.

FL1.png





Hello @jeffreygard1127 

It's an input which we will add in the action, so you can add RITM table as a reference in input and callback this in script step. So, you can use that in script.

 

Thanks,
Murthy

Thank you so much Sir @Murthy Ch your solution works.