Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

How to query a record sys_id in client script portal widget.

Reddy
Kilo Sage

Hello All,

find_real_file.png

 

I'm attempting to use the same HTML href URL in the client script for the Confirm button. However, I am unable to obtain the record sys id.

HTML link for RITM0022516 is 

 <a ng-href="?id=approval&table=sysapproval_approver&sys_id={{::approval.sys_id}}" id="approval_task_{{::approval.sys_id}}"title="{{data.ViewApprovalPageMsg}}">{{::approval.task.number}}</a></span><br>

 

client script URL for Confrim button:

c.openPopUp = function() {
var url = "?id=approval&table=sysapproval_approver&sys_id="+$scope.data.approval.sys_id;
var popup = window.open (url, "popup", "width=900, height=600");
}

 

Thanks,

Reddy

13 REPLIES 13

Can you paste the script in client controller?

 


Please mark this response as correct or helpful if it assisted you with your question.

@Sanjiv Meher 

 

function ($scope,spUtil,snRecordWatcher,spModal,$uibModal,spUIActionsExecuter,$location,$rootScope,$cookies) {
var c = this;
var ticketConversationWidgetID = 'widget-ticket-conversation'; //id for conversation widget displayed in modal
c.data.action = '';
c.data.comment = '';
c.data.collectComments = false;
c.data.message = "";
c.color = "";

if ($scope.options.portal == true || $scope.options.portal == 'true') {
$scope.contentColClass = "col-xs-12";
$scope.options.portal = true;
} else {
$scope.options.portal = false;
$scope.contentColClass = "col-sm-9";
}

$scope.data.op = "";
spUtil.recordWatch($scope, "sysapproval_approver", "state=requested^approverIN" + $scope.data.myApprovals.toString(), function(response) {});
function get() {
spUtil.update($scope);
c.comment = '';
}


$scope.reject = function(id) {
c.onPromptR(id);
}
c.onPromptR = function(id) {
spModal.open({
title: 'Please Provide a Rejection Comment',
message: 'Comments are required when rejecting.',
input: true,
value: c.comment,
buttons: [
{label:'✘ ${Cancel}', cancel: true},
{label:'✔ ${Reject}', primary: true}
]
}).then(function(comment) {
c.comment = comment;

$scope.data.comment = comment;
$scope.data.op = "rejected";
$scope.data.target = id;
get();

})
}

$scope.approve = function(id) {
c.onPrompt(id);
}
c.onPrompt = function(id) {
spModal.open({
title: 'Please Provide An Approval Comment',
message: 'Comments are optional when approving.',
input: true,
value: " ",
buttons: [
{label:'✘ ${Cancel}', cancel: true},
{label:'✔ ${Approve}', primary: true}
]
}).then(function(comment) {
c.comment = comment;

$scope.data.comment = comment;
$scope.data.op = "approved";
$scope.data.target = id;
get();

})
}
c.clickButton = function(action) {
var obj= {
action: action,
something: "anything else"
};
$rootScope.$broadcast('customEvent', obj);
}


c.openPopUp = function() {
var url = "?id=approval&table=sysapproval_approver&sys_id="+c.data.approval.sys_id;
var popup = window.open (url, "popup", "width=900, height=600");
}

// pagination
$scope.previousPage = function() {
if ($scope.data.pagination.currentPage > 1)
$scope.data.pagination.currentPage = $scope.data.pagination.currentPage - 1;
else
$scope.data.pagination.currentPage = 0;

get();
}

$scope.nextPage = function() {
$scope.data.pagination.currentPage = $scope.data.pagination.currentPage+1;
get();
}
}

From your script, looks like you are suppose to use

$scope.data.sys_id


Please mark this response as correct or helpful if it assisted you with your question.

-O-
Kilo Patron

Could you post the HTML around the Confirm button?

@János 

 


<div>
<!-- <span><a href ng-click="c.openPopUp()" uib-tooltip="Comments" tooltip-placement="bottom">&nbsp;<i ng-style="c.setColor();" class="fa fa-comments fa-fw"></i>&nbsp;</a></span> -->

<button ng-click="c.openPopUp()" class="btn btn-primary">confrim</button>
</div>
</div>
<div class="panel-body">
<span ng-if="approval.task.cab_date" class="m-r-sm"><img src="Changerequestapproval.png" class="img im-responsive item-image"/></span>
<span ng-if="approval.variables.length" class="m-r-sm"><img src="Requestapproval.png" class="img im-responsive item-image"/></span>

<div class="col-lg-12">
<span class="header-state">
<a ng-href="?id=approval&table=sysapproval_approver&sys_id={{::approval.sys_id}}" id="approval_task_{{::approval.sys_id}}" title="{{data.ViewApprovalPageMsg}}">{{::approval.task.number}}</a></span><br>
<!-- <ng-if="approval.short_description"><label>${Requested Item:}</label><descript>{{::approval.task.cat_item}}</descript><br></ng-if> -->
<ng-if="approval.task.short_description"><label>${Description:}</label><descript>{{::approval.task.short_description}}</descript></ng-if>

<!-- Change Request -->