need help on widget customization

ihabeeb
Tera Contributor

Hi everyone,

 

We need to develop a 'My Account Team' page within the CSM Portal, allowing customers to access their account information and contacts. I've developed a custom widget for this task, but it's not performing as intended.

Please provide guidance on troubleshooting and fixing the issues with my current widget, or suggest an alternative widget that I can duplicate and implement.

 

 

ihabeeb_0-1703840803699.jpeg

 

 

 

 

ihabeeb_1-1703840803701.jpeg

 

 

4 REPLIES 4

Anil Lande
Kilo Patron

Hi,

Please share script in the for of text (or use script editor), it is difficult to suggest changes on screenshot. Also, share client script part of widget.

 

Please appreciate the efforts of community contributors by marking appropriate response as correct answer and helpful, this may help other community users to follow correct solution in future.
Thanks
Anil Lande

ihabeeb
Tera Contributor

Hello Anil,

Thank you for your prompt response. Here's the HTML and server script for the widget customization:
HTML:

<div class="account-info-widget">
<h2>My Account</h2>
<p>Name: {{c.data.account.name}}</p>
<p>Category: {{c.data.account.category}}</p>
</div>

<div ng-if="loading">
Loading account information...
</div>

<div ng-if="error">
Error loading account information.
</div>

Server Script:
(function() {
var userId = gs.getUser().getID();

var grn = new GlideRecord('customer_contact');
grn.addQuery('sys_id', userId);
grn.query();

if (grn.next()) {
var account = grn.accountDYNAMIC4835748687ab2d103fa3c8c4dabb351b;
var gr = new GlideRecord('customer_account');
gr.addQuery('name', account);
gr.query();

if (gr.next()) {
data.account = {
name: gr.getValue('name'),
category: gr.getValue('rank_tier')
};
} else {
gs.error('No matching records found in customer_account table');
}
} else {
gs.error('No matching records found in customer_contact table for the current user');
}
})();

I appreciate any insights or suggestions you can provide to enhance the functionality.
Thank you , 
Irfan Habeeb.

Can you please share Client script as well?

 

Please appreciate the efforts of community contributors by marking appropriate response as correct answer and helpful, this may help other community users to follow correct solution in future.
Thanks
Anil Lande

Hi Anil,
We figured it out .
Thank you for your help so far .