Hello -
I am new to writing attribute rules in Pro (but not new to the concept), and I am using 3.5.2. In designing a rule to run on an insert trigger, it would be helpful to know if that insert was triggered from pasting a feature versus creating a new feature. Is that information available to me in something like $editcontext? I know that the rule 'knows' that it is a paste or create (via error message - see below), but I do not how to access that information in the rule itself (if that is possible).
I spun up a simple attribute rule that just returns a couple of $field.<field name> values via of an error message to illustrate. When I attempt to create a feature, the error message shows that I was (attempting to) create a new feature:
When I attempt to paste a copied feature, the error message shows this:
Is it possible to suss out that distinction in the rule itself? If so, I would be able to follow a different logic path depending on what was happening.
Thanks so much.
Solved! Go to Solution.
There is no way to detect this in the attribute rule. The only context you have is that it is an insert. You might be able to kind of figure it out by looking at the attributes. Such as you know you have a ID field, that is only populated on insert. If a new record has this value, it was probably copy and pasted. Just make sure the rule to set the value on insert is fired after this rule that evaluates if the feature was a new vs copy/paste.
There is no way to detect this in the attribute rule. The only context you have is that it is an insert. You might be able to kind of figure it out by looking at the attributes. Such as you know you have a ID field, that is only populated on insert. If a new record has this value, it was probably copy and pasted. Just make sure the rule to set the value on insert is fired after this rule that evaluates if the feature was a new vs copy/paste.
Thanks for the confirmation, Mike.