Discussion:
Detecting which field was modified upon saving
(too old to reply)
msandid
2010-03-25 16:33:43 UTC
Permalink
Hi all,

Is there a way to know, upon saving an entity, which of its fields was
modified? Is it also possible to pass this information to a workflow?

The idea is to create a workflow as an audit trail to track changes.
It would be also nice to know which field exactly was changed.

I already have workflows for when a record is created, deleted, or
modified. I'd like to be more specific about which field was changed.
The alternative would be to write a workflow for each field which is
untenable.

Thanks,
Mohamed
msandid
2010-03-26 15:24:12 UTC
Permalink
Post by msandid
Hi all,
Is there a way to know, upon saving an entity, which of its fields was
modified? Is it also possible to pass this information to a workflow?
The idea is to create a workflow as an audit trail to track changes.
It would be also nice to know which field exactly was changed.
I already have workflows for when a record is created, deleted, or
modified. I'd like to be more specific about which field was changed.
The alternative would be to write a workflow for each field which is
untenable.
Thanks,
Mohamed
I guess the way for this is to check the IsDirty flag for each field.
However, can anyone help me with passing the name of the field that
changed as a parameter to a workflow?

Thanks.
Dave
2010-03-26 17:22:28 UTC
Permalink
Post by msandid
Post by msandid
Hi all,
Is there a way to know, upon saving an entity, which of its fields was
modified? Is it also possible to pass this information to a workflow?
The idea is to create a workflow as an audit trail to track changes.
It would be also nice to know which field exactly was changed.
I already have workflows for when a record is created, deleted, or
modified. I'd like to be more specific about which field was changed.
The alternative would be to write a workflow for each field which is
untenable.
Thanks,
Mohamed
I guess the way for this is to check the IsDirty flag for each field.
However, can anyone help me with passing the name of the field that
changed as a parameter to a workflow?
Thanks.
Mohamed,
I would do this:
1) Create a new field called "what changed".
2) Add some onSave Javascript (or a pre-save plugin) that examines
each field to determine if it changed (with a pre-save plugin, you
automatically get the before and after images of each field in the
dataset. For Javascript, you'd have to also create onLoad Javascript
that stored the current value of all fields into global variables.
The onSave Javascript could then compare the current value to the
global variables.)
3) Update the new "what changed" field with the names of the fields
that changed.
4) Let the record save as usual.

To get this to show up on the audit entity, you'd need to also add a
"what changed" field to the audit entity, and update the workflow to
pass the value of that field from the source entity to the audit
entity.
HTH,
Dave

-------------------------------------------
David L. Carr, President
Visionary Software Consulting, Inc.
Cell: 503-351-4207
Email: ***@earthlink.net
http://www.vscrm.com
Peter Hale
2010-03-29 10:48:31 UTC
Permalink
You could also use a Global variable and add the attribute name to it in the
OnChange of each attribute (very cumbersome) and some process that Global
variable.
Post by Dave
Post by msandid
Post by msandid
Hi all,
Is there a way to know, upon saving an entity, which of its fields was
modified? Is it also possible to pass this information to a workflow?
The idea is to create a workflow as an audit trail to track changes.
It would be also nice to know which field exactly was changed.
I already have workflows for when a record is created, deleted, or
modified. I'd like to be more specific about which field was changed.
The alternative would be to write a workflow for each field which is
untenable.
Thanks,
Mohamed
I guess the way for this is to check the IsDirty flag for each field.
However, can anyone help me with passing the name of the field that
changed as a parameter to a workflow?
Thanks.
Mohamed,
1) Create a new field called "what changed".
2) Add some onSave Javascript (or a pre-save plugin) that examines
each field to determine if it changed (with a pre-save plugin, you
automatically get the before and after images of each field in the
dataset. For Javascript, you'd have to also create onLoad Javascript
that stored the current value of all fields into global variables.
The onSave Javascript could then compare the current value to the
global variables.)
3) Update the new "what changed" field with the names of the fields
that changed.
4) Let the record save as usual.
To get this to show up on the audit entity, you'd need to also add a
"what changed" field to the audit entity, and update the workflow to
pass the value of that field from the source entity to the audit
entity.
HTH,
Dave
-------------------------------------------
David L. Carr, President
Visionary Software Consulting, Inc.
Cell: 503-351-4207
http://www.vscrm.com
Continue reading on narkive:
Loading...