- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-14-2023 04:33 PM
Hi, I do not know much about portal changes but I have a requirement to add more details on the change approval widget. Can anyone guide me on how to implement it?
We need to add the following fields after the number with link: Requested by and Description.
Todos Approval URL: /now/nav/ui/classic/params/target/sp_widget.do%3Fsys_id%3Db6cb80e45b582300f1eaefe5f0f91a85%26sysparm_view%3D
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2023 09:27 AM - edited 10-16-2023 09:31 AM
Hi @olufsen , How are you?
I believe the best alternative is to avoid customizations and use "To-dos Configuration > Task Configuration" to add these fields, without using code.
- Type "To-dos Configuration" in the filter navigator and look for the "Approvals" to-do
- In the Related List, click Task Configuration > New:
- Fill in the following fields:
Name: Change Request
Reference column: Approval for
Reference table: sc_req_item
------- Common Info -----
Common info fields type: Fields
Common info fields:
sysapproval.number,due_date,sys_created_on,state
Link to Task: true
----Primary Info-----
Title type: Field
Title: sysapproval.description
Fields (Reference table): requested_by
---- Action ----
Action Group: Approvals action group
SAVE - Go to Tab Configurations > New
- Fill in the following fields:
Type: Attachments
Source: Request
Name: Attachments
SAVE
- Fill in the following fields:
Type: Activity Stream
Name: Activity Stream
INSERT AND STAY - Test
This way, the fields appear automatically, without needing customization, facilitating maintenance, and following good employee center practices.
If my answer helped you, please mark my answer as helpful.
Vanderlei Catione Junior | LinkedIn
Senior ServicePortal Developer / TechLead at The Cloud People
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-14-2023 09:10 PM - edited 10-14-2023 09:10 PM
Hi @olufsen ,
Please see the below updates that you might need to do in the widget.
<div class="panel" id="todo-approval-panel">
<div class="panel-body" id="todo-approval-panel-heading" ng-class="approval-requested">
<div>
<!--Add this for your requirement
<strong>Requested by:</strong> {{c.data.requestedBy}}
</div>
<div>
<strong>Description:</strong> {{c.data.description}}
</div>
-->
<h4 id="approval-message" ng-if="!data.isPosted">{{data.approvalText}}</h4>
<!--
<div>
<strong>Number:</strong> <a ng-href="{{c.data.approvalURL}}">{{c.data.number}}</a>
</div>-->
<sp-widget widget="data.approvalActionsWidget"></sp-widget>
</div>
</div>
Then in the Server Script: Put the below code after the short description related code ends.
if (!gs.nil(sysApprovalRecord.sysapproval.requested_by))
data.requestedBy = sysApprovalRecord.sysapproval.requested_by.getDisplayValue();
if (!gs.nil(sysApprovalRecord.sysapproval.description))
data.description = sysApprovalRecord.sysapproval.description.getDisplayValue();
Try once and get back if you see any issues, happy to help.
Thanks,
Sonam
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2023 07:35 AM
Hi @Sonam Tiwari I updated the widget with the provided changes but it did not returned any values and have these errors.
I made a change to the dot walked you've made and the error was gone but still, it didn't returned any value.
if (!gs.nil(sysApprovalRecord.requested_by))
data.requestedBy = sysApprovalRecord.requested_by.getDisplayValue();
if (!gs.nil(sysApprovalRecord.description))
data.description = sysApprovalRecord.description.getDisplayValue();
In the widget, it called another widget but not sure what to do with this.
URL: /sp_widget.do?sys_id=34a149f0531130107eb7ddeeff7b1271&sysparm_record_target=sp_widget
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2023 09:27 AM - edited 10-16-2023 09:31 AM
Hi @olufsen , How are you?
I believe the best alternative is to avoid customizations and use "To-dos Configuration > Task Configuration" to add these fields, without using code.
- Type "To-dos Configuration" in the filter navigator and look for the "Approvals" to-do
- In the Related List, click Task Configuration > New:
- Fill in the following fields:
Name: Change Request
Reference column: Approval for
Reference table: sc_req_item
------- Common Info -----
Common info fields type: Fields
Common info fields:
sysapproval.number,due_date,sys_created_on,state
Link to Task: true
----Primary Info-----
Title type: Field
Title: sysapproval.description
Fields (Reference table): requested_by
---- Action ----
Action Group: Approvals action group
SAVE - Go to Tab Configurations > New
- Fill in the following fields:
Type: Attachments
Source: Request
Name: Attachments
SAVE
- Fill in the following fields:
Type: Activity Stream
Name: Activity Stream
INSERT AND STAY - Test
This way, the fields appear automatically, without needing customization, facilitating maintenance, and following good employee center practices.
If my answer helped you, please mark my answer as helpful.
Vanderlei Catione Junior | LinkedIn
Senior ServicePortal Developer / TechLead at The Cloud People
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2023 11:29 AM - edited 10-16-2023 12:40 PM
@Vanderlei Got this... I've made the changes and I wanted to add more tab config.. What is the best approach to include the details of the Planning and Schedule tabs, I tried Line Items, but it only shows the CR extended tables.