Closed ashrafalzyoud closed 2 years ago
Hi,
Add to BEFORE SAVE:
# only valid in before_save scripts
def custom_value_changed?(cf)
custom_field_value(cf.id) != custom_value_for(cf.id).try(&:value)
end
And call the this function with:
if custom_value_changed?(1)
# do this...
end
can u plz participant with this ticket
i made some changes cf_id
# only valid in before_save scripts
def custom_value_changed?(cf_id)
custom_field_value(cf_id) != custom_value_for(cf_id).try(&:value)
end
can this function work after _save
if custom_value_changed?(1)
# do this...
end
im try this code and make changes in value cf_1 but the function not work also
@AirTibu
Hi,
Use with @issue:
def custom_value_changed?(cf_id)
@issue.custom_field_value(cf_id) != @issue.custom_value_for(cf_id).try(&:value)
end
This can work in after_save only you store the custom field value in before save (not tested, just an idea):
BEFORE SAVE:
@original_value = @issue.custom_value_for(cf_id).try(&:value)
AFTER SAVE:
if @issue.custom_field_value(cf_id) != @original_value && !@original_value.nil?
# do your code here
end
I hope it helps!
if @issue_custom_field_value(1).changed?
what the correct code plz