How to pass data from client script to workspace Ui Action

ManikandanP7586
Giga Contributor

I'm facing an issue where I need to pass data from a UI Page Client Script to a Workspace Client Script callback function, i referred community articles but this wasn't helpful.

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@ManikandanP7586 

did you explore few of the OOTB UI actions?

somewhere the logic must be present.

you can use callback method, I believe ServiceNow uses iframeMsgHelper for this

Search with UI page client script contains -> iframeMsgHelper

UI page client script using that and including the data to be passed

AnkurBawiskar_0-1754404472331.png

 

Then in workspace client script, it's accessed like this

AnkurBawiskar_1-1754404501990.png

 

OOTB UI page: time_sheet_recall_dialogue

OOTB UI action: Recall (time_card) table

AnkurBawiskar_2-1754404627063.png

 

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

6 REPLIES 6

In my case, the functionality works correctly in Native UI, but in Workspace, I'm unable to retrieve the values as expected.

My requirement is: when a modal opens, it displays some fields. Based on the data entered in those fields, a GlideAjax call is triggered to create a record and return the sys_id and i set it to one field using g_form.setValue().

While the sys_id is successfully returned in Workspace, I'm unable to retrieve or use it properly within the Workspace client script. I’ve tried using iFrameHelper and postMessage, but those approaches didn’t work.



ManikandanP7586_0-1754477785374.png

@Ankur Bawiskar , @kaushal_snow 

@ManikandanP7586 

did you check the OOTB UI page and UI action?

there ServiceNow is passing the data using iframeMessageHelper

May be some part is getting missed and hence it's not working.

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader