The CreatorCon Call for Content is officially open! Get started here.

Unable to view Approval Record Data when record is created through an API

erniec
Giga Expert

Good morning,

 

We have several API's that create change requests in our application. We have noticed that when an API creates a change request, the approval record widget on the approval page does not display the information of the change request. When the same record is created through the UI, the approvers are able to see all of the data under the Options chevron. This behavior happens regardless of the account that is used to create the record through the API. My assumption was this was a roles/acl issue but I am able to recreate the same behavior using an admin account. The approvers are able to navigate to the service desk and view the approving record without an issue. This seems to only happen on the Approval page on the Service Portal

 

When I logged to the console using $scope.data on the Approval Record Widget, the Object does not return any variables when created through the API. However, when an approval is created through the UI the change variables are returned in the object without an issue(with the same approver).

 

Anyone have any suggestions?

6 REPLIES 6

James Chun
Kilo Patron

Hi @erniec,

 

Can you please share some screenshots of the Approval page?

As you mentioned, it's most likely to be an access issue.

I suspect there is a logic that checks if the 'opened_by' is equivalent to the current user.

 

Also, are you able to share XML exports of the two Change Request records (one created via API and one created via UI)?

 

Cheers

Hey James thanks for your response. The XML records are pretty much identical.

 

On the approval widget there a line that:

data.variables=new GlobalServiceCatalogUtil.getVariablesForTask(task, true);

data.variableSummarizerWidget=$sp.getWidget('sc-variable-summarizer',('variables':data.variables,'toggle':true,'task':t.number.value))

 

 

When an approval record is created where is the data that is shown on the approval page stored? Its seems to be a snapshot of the information at the time of creation because if you change any information on the main record, it does not change the information that is viewed on the approval page. This would point me to why the variables are not created when it originates from an API and not through an interactive user. 

Hi @erniec,

 

The 'approval_summarizer' Macro displays the data in the backend.

JamesChun_0-1713214620522.png

Note that this data will be updated if the record being approved (CHG in this case) is updated.

In the above example, the 'Justification' field was updated after the approval record was created and the change is reflected on the approval record as well.

 

My understanding is that CHG's approval record will not show much information in the portal by default. The following screenshot was taken from my PDI.

JamesChun_1-1713214767372.png

Are you aware if there is any customization done on the Approval Record widget or anywhere else?

Do you mind sharing a screenshot of the Approval page of the portal as well?

 

Cheers

Hey James,

Thank you for your response.

 

This is what ?id=approval portal widget looks like when an approval is created through the UI. The approval widget has not been customized and is out of the box. You see a summary of all the values

 

erniec_0-1713279435556.png

When created through an API this is what an approval pages looks like. For this record, the values on the record as the UI created Change Request but the approval values

erniec_2-1713279697728.png