Wednesday, 9 August 2017

Salesforce Trailhead : Process Automation Super Badge


Challenge 1:

Validation rule on Lead

Country Validation Rule

Condition Formula: NOT( 
OR(
Country = "US",
Country = "USA",
ISBLANK( Country )
)
)

Error Location: Field Country

State Validation Rule

Condition Formula: OR( 
LEN(State) <> 2,
NOT(CONTAINS("AL:AK:AZ:AR:CA:CO:CT:DE:DC:FL:GA:HI:ID:" &
"IL:IN:IA:KS:KY:LA:ME:MD:MA:MI:MN:MS:MO:MT:NE:NV:NH:" &
"NJ:NM:NY:NC:ND:OH:OK:OR:PA:RI:SC:SD:TN:TX:UT:VT:VA:" &
"WA:WV:WI:WY:PR", State))
)
Error Location: Field State

Queues:

Queue Name: Rainbow Sales

Queue Name: Assembly System Sales

Assignment Rule:

Rule Name: Trailhead Assigment Rule

Challenge 2:

Account Validation Rules

Billing Country Rule


Shipping Country Rule

Billing State Rule


Shipping State Rule


Account Name Rule

Account Fields:


  • Number of deals (Roll-Up Summary field): Count Opportunity. No filter criteria
  • Number of won deals (Roll-Up Summary field): Count Opportunity with filter criteria as "Stage equals Closed Won"
  • Last won deal date (Roll-Up Summary field): MAX(Opportunity: Close Date) with filter criteria as "Stage equals Closed Won"
  • Deal win % (Formula field): Number_of_won_deals__c / Number_of_deals__c
  • Total amount of won deals (Roll-Up Summary field): SUM(Opportunity: Amount) with filter criteria as "Stage equals Closed Won"
  • Call for Service (Formula field): IF( DATE( YEAR(Last_won_deal_date__c)+2 , MONTH(Last_won_deal_date__c) , DAY(Last_won_deal_date__c) ) <= TODAY(), 'Yes', 'No')

Challenge 3:

Custom Object Creation



Challenge 4:

Add Stage Value:


Add Custom Field:


Add Sales Process:


Add Recordtype

Validation Rule

Challenge 5:

Approval Process:


Note: Make sure you populate manager field on your user record with some valid user. In this case make your manager as Naushi(User you created in your org). If you wont select user manager you wont be able to submit for approval.

Email Alert


Note: Make sure you add a user in email alert

Process Builder:

Opportunity object with option created and updated.

1st and 2nd node end will be changed to evaluate next criteria.



1st Node Criteria

Opportunity Account Type = customer and opportunity.account id not equal to null

1st Node Action

2nd Node Criteria

Opportunity stage = prospecting and opportunity.account id not equal to null and opportunity account type = Prospect.


Note: there will be 2 actions 1 is email same as above and second is creating task. 

2nd Node Action:


3rd Node Action:

Opportunity Stage = Negotiation/Review

3rd Node Action:

4th Node Criteria:

Opportunity Stage = Closed Won

4th Node Action:

2 actions are used in this node.


Challenge 6:

Flow:


  • Flow must be of type Flow. 
  • Screen with 3 choices and store the result in screen choice fields : ProductType
  • Lookup to find records in product2 with contains ProductType and store them as variables (Id + name) 
  • Screen to display variables 
  • Activate the flow 
  • Add the flow to the opportunity screen using app builder.








Lightning Page:

A record page on Opportunity object. 
Drag and drop flow component on it and save.
Activate page.


Challenge 7

  • Change field type of field "Day of the Week" on robot object to formula text and use below formula.
  • CASE( MOD( Date__c - DATE(1900,1,6),7) , 0, "Saturday",1,"Sunday",2,"Monday",3,"Tuesday",4,"Wednesday",5,"Thursday",6,"Friday","")
  • Go on Process builder created in step 5.(You have to clone this Process Builder in order to make changes)
  • Go on 4th Node of closed Won opportunity.
  • Go on action create setup record.
  • Change formula of date field from [Opportunity].CloseDate + 180..
  • to
  • CASE(MOD([Opportunity].CloseDate + 180 - DATE(1900, 1, 7),7), 0, [Opportunity].CloseDate + 181, 6, [Opportunity].CloseDate + 182, [Opportunity].CloseDate + 180)
  • Save and activate.
Happy Coding!!!