I had a business requirement to update "Company Name" next to user name on task activity Log

Sachin Mathew
Tera Contributor

My team had a business requirement to update dynamic company name next to user name based on user's company on activity logs without modifying Dictionary. Please refer image in place of line we want to update company name or else do we have any way to show a popup view on activity log of user name?
Screenshot 2024-08-05 120927.png

9 REPLIES 9

Hello @Sachin Mathew ,

 

You can below code in your BR (after update) -

var companyID = gs.getUser().getCompanyID(); //get sy_id of company

var coreCom = new GlieRecord('core_company');

if(coreCom.get(companyID)){

current.work_notes = coreCom.name;

}

 

Hope it helps.

 

Regards,

Shubham

We tried BR below screenshot is output. We don't want to update that in next line instead of that we want the Company name next to our name(Yellow highlighted).

SachiMathew_1-1722845643388.png

 

 

Hello @Sachin Mathew ,

 

Then this code piece needs to be Journal Entry (sys_journal_field) table (Before insert).

 

You have to concatenate the logged in user company name (fetch it using above logic).

 

Note - This change would be applicable to all tables using journal fields. (To restrict it to specific table, need to write custom script but there would be performance delay.)

 

Kindly mark this as Accepted Solution/Helpful if it helps.

Regards,

Shubham

Hi @Shubham Garg
Can you please share me where to concatenate the value of Company in 'sys_joural_field' table because we don't see any user related info there.

Hello @Sachin Mathew ,

 

Journal Entry table [sys_journal_field] does contain a reference to the table record on which comment/work notes are updated.

That table reference has to be Glided and dot walked to get the user info.

 

https://<instance>.service-now.com/sys_dictionary_list.do?sysparm_query=name%3Dsys_journal_field&sysparm_view=

 

Hope it helps.

 

Regards,

Shubham