Create new record on dialog input
I've tried several variations of this (including a function) but so far nothing works.
I'd like to enter a customer number ("User card") in a number field ("Get a record"), and if the number exists popup the record (trigger on update.)
However, if the record does not exist I would like a dialog box to open asking to create a new record (yes/no). If yes create a new record else open the "Main" table.
Here's what I've got that doesn't work:
let myInput := number(this.'Get a record');
let myRecord := first(select Users where 'User Card' = myInput);
let myRecordId := number(myRecord.Id);
if myRecord then
popupRecord(record(Users,myRecordId))
else
let result := dialog("User not Found", "Create new user?", ["Yes", "No"])
if result = "Yes" then
alert("Create record here")
else
alert("Open Start table")
end
end
I've tried it with parenthesis around it, without, semi-colons, etc. and it won't do anything at all even if the customer number exists.
This works:
let myInput := number(this.'Get a record');
let myRecord := first(select Users where 'User Card' = myInput);
let myRecordId := number(myRecord.Id);
if myRecord then
popupRecord(record(Users,myRecordId))
else
alert("Here's an alert")
end
I'm not sure what the problem is or if there is an alternative to make it work. Any advice is appreciated.
1 reply
-
You can book a screensharing session with me via this link:
https://calendly.com/birger-hansen/15min
Content aside
- 6 yrs agoLast active
- 1Replies
- 2293Views