AlexFreeman
5 years agoQrew Trainee
URL Formula with conditionals
I have a URL - Formula field that I made a button for. It checks a box, records a date and time, and the person who clicked the button (fids 142, 155, and 182 respectively). I want it to also do the same for a second set of fields (fids 143, 161, 184) if the person clicking the button (fid [User Acceptance User]) matches another field (fid [Request User]).
So, in short I want the workflow like this.
Click Button
Record fields
Then If user matches in two separate fields, record additional fields.
This is the code I'm using now. I'm having a problem with the execution at the bottom. It seems to eat up the url into numbers and letters (I'm assuming because of the If conditional). Is there a way to make this work?
var bool RequestorISTester = If([Request User]=[User Acceptance User],true,false);
var text TestingApproved=
URLRoot() & "db/"
& Dbid() & "?a=API_EditRecord&rid=" & [Record ID#]
& "&apptoken="&URLEncode([validapptoken])
& "&_fid_142=1"
& "&_fid_155="&URLEncode(Now())
& "&_fid_182="& URLEncode(UserToName(User()));
var text ReDisplay=
URLRoot() & "db/"
& Dbid()
& "?a=dr&rid="
& [Record ID#];
var text MovetoProdApprove=
URLRoot() & "db/"
& Dbid() & "?a=API_EditRecord&rid=" & [Record ID#]
& "&apptoken="&URLEncode([validapptoken])
& "&_fid_143=1"
& "&_fid_161="&URLEncode(Now())
& "&_fid_184="& URLEncode(UserToName(User()));
$TestingApproved
& "&rdr=" & If($RequestorISTester=true, URLEncode($MoveToProdApprove), $RequestorISTester=false, URLEncode($ReDisplay))
& URLEncode("&rdr=" & URLEncode($ReDisplay))
------------------------------
Alex Freeman
------------------------------
So, in short I want the workflow like this.
Click Button
Record fields
Then If user matches in two separate fields, record additional fields.
This is the code I'm using now. I'm having a problem with the execution at the bottom. It seems to eat up the url into numbers and letters (I'm assuming because of the If conditional). Is there a way to make this work?
var bool RequestorISTester = If([Request User]=[User Acceptance User],true,false);
var text TestingApproved=
URLRoot() & "db/"
& Dbid() & "?a=API_EditRecord&rid=" & [Record ID#]
& "&apptoken="&URLEncode([validapptoken])
& "&_fid_142=1"
& "&_fid_155="&URLEncode(Now())
& "&_fid_182="& URLEncode(UserToName(User()));
var text ReDisplay=
URLRoot() & "db/"
& Dbid()
& "?a=dr&rid="
& [Record ID#];
var text MovetoProdApprove=
URLRoot() & "db/"
& Dbid() & "?a=API_EditRecord&rid=" & [Record ID#]
& "&apptoken="&URLEncode([validapptoken])
& "&_fid_143=1"
& "&_fid_161="&URLEncode(Now())
& "&_fid_184="& URLEncode(UserToName(User()));
$TestingApproved
& "&rdr=" & If($RequestorISTester=true, URLEncode($MoveToProdApprove), $RequestorISTester=false, URLEncode($ReDisplay))
& URLEncode("&rdr=" & URLEncode($ReDisplay))
------------------------------
Alex Freeman
------------------------------