Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Issue with client side API method on workspace

Snehal13
Kilo Sage

g_aw.openRecord (tablename, sysid, params); isnt working.

 

I am trying to open incident form and auto populate short description on the new incident form through workspace client script of a UI action.

 

Here is the snippet -

 

var getShortDescription = g_form.getValue('short_description');

g_aw.openRecord ('incident', '-1', {short_description : getShortDescription } );

 

The above opens a new incident form but the short description is not getting populated. This code is written in workspace client script section of a UI button. It is client callable checked.

 

Note that I am able to get the value of ' g_form.getValue('short_description');' in an alert. The population part of g_aw.openRecord isnt working. Followd the documentation but stuck with this fields population part.

 

Any inputs. 

6 REPLIES 6

Eswararao Chap1
Tera Contributor

Hi @Snehal13 what is the workspace you are using for this?

 

CSM workspace. the API method works , just the params part isnt working. following this https://docs.servicenow.com/en-US/bundle/utah-api-reference/page/app-store/dev_portal/API_reference/...

An UPDATE - This code works

 

var query = "short_description=" + short_description_text;

        g_aw.openRecord('incident''-1', {
        "query": query
    });
 
Now, need to know how to pass multiple values like category, priority etc in 'query'
 
Any inputs

Mohith Devatte
Tera Sage
Tera Sage

Hello @Snehal13 ,

Can you try this once ?

var getShortDescription = g_form.getValue('short_description');

g_aw.openRecord ('incident', '-1', "params": {
"short_description":getShortDescription;

} );

 

 

If this answer helped you please mark it correct 

Thanks