- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-19-2024 08:18 AM
I am creating an incident when user enters the issue and clicks on create in portal widget but not able to display the incident number created using c.server.get(obj).then(function (response)....console.log is showing the correct incident number created but in client controller it is showing [object object]
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-22-2024 02:46 AM
Thanks, you can fix the issue by replacing the following server script
data.incident = inc.number;
to
data.incident = inc.getValue('number');
If you print out the response.data object, you will notice something like the below:
You can see the value of the 'incident' key is an object.
I am not 100% sure why it works on the console.log but GlideRecord.field returns an object and that's why you need to use either field.toString() or getValue('field');
Cheers
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-19-2024 02:21 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-22-2024 02:09 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-22-2024 02:46 AM
Thanks, you can fix the issue by replacing the following server script
data.incident = inc.number;
to
data.incident = inc.getValue('number');
If you print out the response.data object, you will notice something like the below:
You can see the value of the 'incident' key is an object.
I am not 100% sure why it works on the console.log but GlideRecord.field returns an object and that's why you need to use either field.toString() or getValue('field');
Cheers
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-22-2024 02:57 AM
Hi @Tiasha ,
Can you please try to return like
return JSON.stringify(yourVariable);
Please mark my answer correct and helpful if this works for you
Thanks and Regards
Sarthak