Update My Task approval view for Change Records

olufsen
Kilo Sage

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.

olufsen_0-1697325190772.png

 

Todos Approval URL: /now/nav/ui/classic/params/target/sp_widget.do%3Fsys_id%3Db6cb80e45b582300f1eaefe5f0f91a85%26sysparm_view%3D

 

 

 

1 ACCEPTED SOLUTION

Vanderlei
Mega Sage

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.

 

  1. Type "To-dos Configuration" in the filter navigator and look for the "Approvals" to-do

  2. In the Related List, click Task Configuration > New:

  3. 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

     

    Vanderlei_0-1697473523086.pngVanderlei_1-1697473538319.pngVanderlei_2-1697473549569.png

     

  4. Go to Tab Configurations > New
  5. Fill in the following fields:

    Type: Attachments

    Source: Request

    Name: Attachments

    SAVE
    Vanderlei_4-1697473585391.png

  6. Fill in the following fields:

    Type:  Activity Stream

    Name: Activity Stream
    INSERT AND STAY
    Vanderlei_3-1697473572449.png

  7. Test

    Vanderlei_5-1697473705526.png

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

View solution in original post

7 REPLIES 7

Sonam Tiwari
Tera Guru

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

Hi @Sonam Tiwari I updated the widget with the provided changes but it did not returned any values and have these errors.

olufsen_0-1697466328125.pngolufsen_1-1697466355592.png

olufsen_2-1697466375079.png

 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

 

 

Vanderlei
Mega Sage

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.

 

  1. Type "To-dos Configuration" in the filter navigator and look for the "Approvals" to-do

  2. In the Related List, click Task Configuration > New:

  3. 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

     

    Vanderlei_0-1697473523086.pngVanderlei_1-1697473538319.pngVanderlei_2-1697473549569.png

     

  4. Go to Tab Configurations > New
  5. Fill in the following fields:

    Type: Attachments

    Source: Request

    Name: Attachments

    SAVE
    Vanderlei_4-1697473585391.png

  6. Fill in the following fields:

    Type:  Activity Stream

    Name: Activity Stream
    INSERT AND STAY
    Vanderlei_3-1697473572449.png

  7. Test

    Vanderlei_5-1697473705526.png

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

@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.