Forum Discussion
ArchiveUser
9 years agoQrew Captain
well no one else helped me so I ended up doing this for the button code:
var text base = URLRoot() & "db/" & Dbid();
var text eAPI = $base & "?a=er&rid=" & [Quote ID#]&"&ticket=" & [Ticket] & "&apptoken=" & [Token];
var text cJS ="javascript:void(copyMasterDetailButtonHandler('&relfids=192,194,250©Fid=327&destrid=0&sourcerid=" & [Quote ID#] & "','"& Dbid()&"'))";
var text cop = "<a id='userButton' class='Vibrant Primary' href=\"" & $cJS &"\">Copy Detailed Quote</a>";
var text unl = "<a id='userButton' class='Vibrant Danger' href=" &$eAPI &"\">Click if not redirected to unlock and edit</a>";
var text red =$unl &"<br>"&[iol]&"redirect.js"&[/iol];
var text InnerText=
If([Clone Trigger]=true,$red,$cop);
$InnerText
and in the script redirect.js:
(function() {
//get url string
var str = window.location.href;
//change view to edit
String.prototype.replaceAt = function(str, character) {
return this.substr(0, str) + character + this.substr(str + character.length);
}
str = str.replaceAt(49, "e");
setTimeout(function() {
window.location.href = str;
}, 800);
})();
which just takes it from view to edit
var text base = URLRoot() & "db/" & Dbid();
var text eAPI = $base & "?a=er&rid=" & [Quote ID#]&"&ticket=" & [Ticket] & "&apptoken=" & [Token];
var text cJS ="javascript:void(copyMasterDetailButtonHandler('&relfids=192,194,250©Fid=327&destrid=0&sourcerid=" & [Quote ID#] & "','"& Dbid()&"'))";
var text cop = "<a id='userButton' class='Vibrant Primary' href=\"" & $cJS &"\">Copy Detailed Quote</a>";
var text unl = "<a id='userButton' class='Vibrant Danger' href=" &$eAPI &"\">Click if not redirected to unlock and edit</a>";
var text red =$unl &"<br>"&[iol]&"redirect.js"&[/iol];
var text InnerText=
If([Clone Trigger]=true,$red,$cop);
$InnerText
and in the script redirect.js:
(function() {
//get url string
var str = window.location.href;
//change view to edit
String.prototype.replaceAt = function(str, character) {
return this.substr(0, str) + character + this.substr(str + character.length);
}
str = str.replaceAt(49, "e");
setTimeout(function() {
window.location.href = str;
}, 800);
})();
which just takes it from view to edit