Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X
Hello All,
To make it easier to create notification rules, I would like to provide our users a batch file they just need to run.
Creating and running the file is no problem and works fine, but "Set Email Notifications" should look like this:
Unfortunately, I have not yet been able to find out how to set up "New Value" via the CLI.
When I output the above settings in the CLI (via "Im viewuser") I get the following NotificationRule:
((((field["Assigned User"] <> "me") and (field'["Assigned User"] = "me") and (field["Modified By"] != "admin")) and ((field["Type"] = "Request for Change") or (field["Type"] = "Change Order") or (field["Type"] = "Defect"))))
The "New Value" of "Assigned User [New Value]" is completely missing here. If I would use this in the batch file, I would not get the desired notifications.
How can I set the "New Value" in the CLI? What do I have to enter?
Many thanks in advance!
Solved! Go to Solution.
The new value is represented by a single quote after the field keyword.
For example:
im edituser --notificationRule="(field'[State] = ALM_Active)" ascott
Will show as State [New Value] = ALM_Active
I hope this helps!
-Andrew
The new value is represented by a single quote after the field keyword.
For example:
im edituser --notificationRule="(field'[State] = ALM_Active)" ascott
Will show as State [New Value] = ALM_Active
I hope this helps!
-Andrew
Hello ascott,
Thank you for your response!
I was actually thinking the same thing.
As you can see in the first post, I got a single quote when outputting the notification rule from GUI.
Unfortunately, it doesn't work the other way around though. When I copy the rule one to one and return it via CLI or batch-file no "New Value" is displayed. The single quote is simply skipped.
It is the same with <> in the desired notification rule.
In the GUI I can select <> and also output it via CLI (output is: field["Assigned User"] <> "me").
If I copy this one-to-one and want to return it via CLI, I get the following message:
">" cannot be processed syntactically at this point.
It can only be processed if I use field["Assigned User"]"<>me"
Do you have any idea why the single quote is skipped here, or why <> is not accepted outside the quotes?
It is tempting to follow the syntax of viewuser in your edituser command; however, all those double quotes cause problems. Here is my suggestion:
Here is a working example that successfully runs from a batch file:
im edituser --notificationRule="((field'[State] = ALM_Active) and (field'[Type]<> ALM_Requirement Document))" ascott
Notice how no quotes (of any kind) are necessary around the field names - even when they contain a space.
Thank you very much!
If only the double quotes are used at the beginning and end, it works fine. Also the [New Value] is now inserted correctly.
Great!