Hi i want to display hr task description on portal page like hr case.

vijani
Tera Expert

Hi All,

I want to display hr task description on portal page like hr case description (Please refer the below screenshot). could you please assist me how to achieve this requirement?  

 

vijani_0-1707225118243.png

 

@Ankur Bawiskar @Community Alums 

2 REPLIES 2

Ankur Bawiskar
Tera Patron
Tera Patron

@vijani 

not sure if you could customize that

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

Shaqeel
Mega Sage

Hi @vijani 

 

To display HR task description on a portal page like HR case description, you can follow these steps:

 

1. **Create a Server Script**: This script will fetch the HR task description from the HR task record. You can use GlideRecord to query the HR task table and get the description field.

Here is a sample code:

javascript

var gr = new GlideRecord('sn_hr_core_task');

gr.addQuery('number', 'TASK0010001'); // replace with your task number

gr.query();

if (gr.next()) {

data.description = gr.getValue('description');

}

 

2. **Create a Client Script**: This script will be used to display the fetched description on the portal page. You can use AngularJS or other JavaScript frameworks to bind the data to the HTML element.

Here is a sample code:

javascript

$scope.description = server.data.description;

 

3. **Update the HTML Template**: Add a new HTML element to your portal page where you want to display the HR task description. Bind the description data to this element.

Here is a sample code:

html

{{description}}
 

4. **Test Your Changes**: Finally, test your changes by navigating to the portal page and checking if the HR task description is displayed correctly.

 

Remember to replace the task number in the server script with the actual task number you want to display. Also, make sure that the user has the necessary permissions to view the HR task record.

 

Mark Helpful/Solution 🙂

 

Regards

Shaqeel


***********************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting "Accept as Solution" and " Helpful." This action benefits both the community and me.

***********************************************************************************************************************





Regards

Shaqeel