What is the value of the number field of the object that is obtained - ProProfs Discuss
Topics
Products
Follow Us:

What is the value of the number field of the object that is obtained from Trigger.old? The initial value for a number field on a record is 1. A user updated the value of the number field to 10. This action invokes a workflow field update, which changes the value of the number field to 11. After the workflow field update, an update trigger fires.



A. Null
B. 11
C. 1
D. 10

This question is part of Salesforce Platform Developer 1
Asked by Wyatt Williams, Last updated: Apr 01, 2020

+ Answer
Request

3 Answers

John Smith

John Smith

Answered Apr 04, 2017

1

####
1
 1

Ash

Ash

Replied on Sep 26, 2017

Any reason why can't it be 10 and why is it 1?

Liquad (Qingjun) Li

Write something about yourself

Liquad (Qingjun) Li, Software Engineer, Enter your education, Shanghai, China

Answered Oct 17, 2018

Trigger is fired twice:
1st:
15:19:41.0 (5713537)|USER_DEBUG|[6]|DEBUG| old test_number_2__c: 1
15:19:41.0 (7522682)|USER_DEBUG|[9]|DEBUG| new test_number_2__c: 10
2nd:
15:19:41.71 (73753198)|USER_DEBUG|[6]|DEBUG| old test_number_2__c: 1
115:19:41.71 (75599696)|USER_DEBUG|[9]|DEBUG| new test_number_2__c: 11

 

amigo

Amigo

Answered Jan 25, 2018

Trigger.oldcontains a version of the objects before the specific update that fired the trigger. However, there is an exception. When a record is updated and subsequently triggers a workflow rule field update,Trigger.oldin the last update trigger won’t contain the version of the object immediately prior to the workflow update, but the object before the initial update was made. For example, suppose an existing record has a number field with an initial value of 1. A user updates this field to 10, and a workflow rule field update fires and increments it to 11. In the update trigger that fires after the workflow field update, the field value of the object obtained fromTrigger.oldis the original value of 1, rather than 10, as would typically be the case.

 

Search for Google images
Select a recommended image
Upload from your computer
Search for Google images
Select a recommended image
Upload from your computer
Search for Google images
Select a recommended image
Upload from your computer

Email Sent
We have sent an email to your address "" with instructions to reset your password.