function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
abi060988abi060988 

Created time of an opportunity

How to get the created time of an opportunity based on the created date. The created date datatype is datetime.

abi060988abi060988

I created an opportunity and assigned to an user and the current time is 2:55 pm here and i need to create an remainder alert after 2 hrs (4:55 pm) when an candidate is not added to this opportunity.

 

I have created candidate opportunity association if the candidate is not associated to an opportunity within that timeframe an alert should be sent to the recruiter.

hchhch

You can extract the opportunity created time from created Date as follows:

 

Opportunity opp = [select id,CreatedDate from Opportunity limit 1];

String localTime = opp.CreatedDate.format('hh:mm a');

 

localTime variable contains the created time of the opportunity.

abi060988abi060988

ok will check and this will work in triggers but i need in workflow rules is there any function for that

abi060988abi060988

i have seen a formula in the advanced formulaes like MID (TEXT (Due_Date_Time__c), 12, 5) for the time of the day.

 

Any idea abt this. Kindly advice

hchhch

The given formula will return the time of the datetime field. But it doesn't consider the time zone issue. The formula returns the time as per the standard GMT +00:00 time zone.

 

developerindudeveloperindu

Hi,

 

You can create a workflow rule to execute only when the Candidate field is Blank...The workflow action will be a time based trigger and it'll be an email alert to trigger 2 hours after Created Date. I guess this should work fine.

abi060988abi060988

here the candidate and opportunity are master detail relationship in candidateopportunity association so i cannot find the candidate field of candidateopportunity association in rule criteria. How to do this?

developerindudeveloperindu

Hi,

Please create a roll up summary field in the master and use count function to count no of candidate records. So now u can use the rule to check if count field is greater than 1 after 2 hours...and trigger the email alert...