最近搜索
没有最近搜索

Jose Smith
已加入2021年10月16日
·
最后活动2021年10月16日
关注
0
关注者
0
活动总数
2
投票
0
订阅
1
活动概览
标记
文章
帖子
社区评论
文章评论
活动概览
的最新活动 Jose Smith
Jose Smith 创建了一个帖子,
帖子 Developer - Zendesk Apps Framework (ZAF)
Hi,
In modal.html, create a button. In the first function getData(), I can retrieve the sunshine object ID dynamically. Is there a way to also retrieve the ticket.requester.id and the sunshine.object.id in the buttonOrder() function? I bold these two variables in the function.
Any guidance is appreciate, thanks!
var client = ZAFClient.init();
client.on('app.registered', init);
function init(){
var hashes = window.location.hash;
var param = hashes.split('&');
id = param[0].replace('#','');
requester_id = param[1];
getData();
};
//Function - Get data from custom objects
function getData(){
//Get object's attributes
var objectSettings = {"url": "/api/sunshine/objects/records/" + id};
client.request(objectSettings).then(function(response){
//Loop through object's attributes and create list (see function below)
createAttributeList(response);
//Get events related to current object, loop through and create list (see function below)
createEventList(response);
}).catch(function(error){
//Display error message (see function below)
showCoError(error);
});
function buttonOrder() {
let options = {
url: 'https://d3v-test.zendesk.com/api/v2/users/'+ ticket.requester.id + '.json',
type: 'PUT',
dataType: 'json',
contentType: 'application/json',
cors: true,
data: JSON.stringify({
"user": {"order_id": sunshine.object.id}
})
};
已于 2021年10月14日 发布 · Jose Smith
2
关注者
3
投票
1
Comment