Unable to access the rest message from UI Action.

Allu Gopal1
Giga Guru

I am unable to access the rest message from UI Action in walkup experience application. I have implemented the same scenario in incident it worked.

 

I took reference of these videos: 

Integration Between Zoom Meeting & ServiceNow

Integration Between Zoom Meeting & ServiceNow

 

Code I have used in UI action:

 

var i = current.u_start_time;
var disp = i.getDisplayValue();
var date = i.split(' ')[0];
var time = i.split(' ')[1].split(' ')[0];
var dateTime = date + 'T' + time + 'Z';
gs.addinfoMessage(dateTime);
try {

        var r = new sn_ws.RESTMessageV2('Zoom_Meet_Walkup', 'Post Zoom Walkup');
        r.setStringParameterNoEscape('duration', current.u_duration);
        r.setStringParameterNoEscape('start_time', dateTime);
        r.setStringParameterNoEscape('title', current.u_meeting_title);

var response = r.execute();
var responseBody = response.getBody();
var httpStatus = response.getStatusCode();

current.work_notes = responseBody;
current.u_meeting_url = JSON.parse(responseBody).join_url;
current.u_meeting_details = "Meeting Id : " + JSON.parse(responseBody).id + "\n" + "Passcode : " + JSON.parse(responseBody).password;
current.comments = "Zoom Meeting Title : " + current.u_meeting_title + "\n" + "Start Time : " + disp + "\n" + "Meeting Url : " + JSON.parse(responseBody).join_url + "\n\n" + "---Meeting Logins---" + "\n" + "Meeting Id : " + JSON.parse(responseBody).id + "\n" + "Passcode : " + JSON.parse(responseBody).password + "\n";
current.update();
action.setRedirectURL(current);
} catch (ex) {
var message = ex.message;
}

 

 

It is working with global application but when i tried with walk-up experience it is not working.

 

It usually work like this in below screenshot.

AlluGopal1_0-1694590134565.png

 

Please let me know where i am doing mistake.

 

Thanks and Regards,

Allu Gopal.

1 ACCEPTED SOLUTION

Ah yes indeed. capitol i is needed in addInfoMessage.

Easy to oversee, but easy to find as well by using some debugging lines.

Please mark my response as answer, so that the question can be closed.


Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.

View solution in original post

3 REPLIES 3

Peter Bodelier
Giga Sage

Hi @Allu Gopal1,

 

Add some logging in the script. For example log the message variable in the catch.
Based on that we may be able to help.


Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.

Allu Gopal1
Giga Guru

Hi Peter,

 

Thanks for the reply, I found that issue which is addinfoMessage is not working after i had commented it started working.

com.glide.script.RhinoEcmaError: Cannot find function addinfoMessage in object [object GlideSystem].
sys_ui_action.43fc0ab49711311096813bc3f153afdd.script : Line(6) column(0)
3: var date = i.split(' ')[0];
4: var time = i.split(' ')[1].split(' ')[0];
5: var dateTime = date + 'T' + time + 'Z';
==> 6: gs.addinfoMessage(dateTime);
7: try {
8: var r = new sn_ws.RESTMessageV2('Zoom_Meet_Walkup', 'Post Zoom Walkup');
9: r.setStringParameterNoEscape('duration', current.u_duration);

 

Thanks and Regards,

Allu Gopal.

Ah yes indeed. capitol i is needed in addInfoMessage.

Easy to oversee, but easy to find as well by using some debugging lines.

Please mark my response as answer, so that the question can be closed.


Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.