Wednesday, 18 April 2018

Salesforce Spring ’18 Release Exam



Salesforce Certified Administrator - Spring '18 Release Exam
Time Remaining: 27:42
Top of Form

1 of 6.
What are the path steps based upon when creating a campaign path?

A.
Picklist field values
B.
Business processes
C.
Lead record types
D.
Campaign responses
Mark this item for later review.

2 of 6.
Which three functions are available with chart enhancements in Lightning Experience?

Choose 3 answers

A.
Set chart legend position.
B.
Show total in the center of donut charts.
C.
Combine small groups into "Others" on any chart.
D.
Display up to 2,000 groups in line and bar charts in dashboards.
E.
Download chart images from dashboard components.

Mark this item for later review.
3 of 6.
Which three features are available with Salesforce Files?

Choose 3 answers

A.
Automatically upload .pdf files from an email attachment.
B.
Access files with the view list of assets feature.
C.
Create Asset Files for Unauthenticated users.
D.
Allow Standard Users to create and delete content assets.
E.
Integrate Quip to chat and collaborate on Files.
You must select exactly 3 responses.
4 of 6.
The Administrator for Universal Containers is asked to provide the Sales teams with Opportunity Splits so that the opportunity owner has better visibility into their share of the deal. Which funtionality is available with Opportunity Splits?

A.
Create a new Opportunity Split directly from the account record.
B.
Send Opportunity Split notifications automatically.
C.
Add or adjust splits from the Opportunity Splits related list.
D.
Assign a dedicated opportunity owner to the split.

Mark this item for later review.



Time Remaining: 17:04
Top of Form
5 of 6.
What must the administrator consider when enabling Themes?

A.
Any user can select a theme and avatar based on their role.
B.
Only one theme can be active at a time and is applied to the entire org.
C.
Chatter External Users also see the custom theme.
D.
There is no built-in theme if a custom theme is not created.
Mark this item for later review.



Tuesday, 27 March 2018

How to use Surveyforce for Custom Object(Any Object)


Title: How to use Surveyforce for Custom Object(Any Object)




Requirement(Use Case): How to send a Survey Link to customer/consumer once the order is delivered to the Customer. So one manufacturing company( THE INDIA AMUL TEA) would like to capture the feedback from the customer corresponding to the recent order which is being completed by the Manufacturing company with help of some short of Questionnaire. THE INDIA AMUL TEA company is already using salesforce to capture the Primary Order as well as Secondary Order from the Customer. So THE INDIA AMUL TEA company would like to use some native application to gather feedback from Customer.

Solution: In this Solution, let's Assume THE INDIA AMUL TEA is using Order using Custom Object Name Called Order__c.

and Order__c object following fields are there
  • Order amount----Currency Field
  • Order Primary Person Email Id---Email Field
  • Order Number--Auto Number field
  • Order Stage--Picklist(Draft, Accepted, Shipped, Delivered)
Step 1. Install surveyforce app in your Org. https://appexchange.salesforce.com/appxListingDetail?listingId=a0N30000003I2gDEAS

Post Install Guide - Public Facing Surveys

  1. General Surveys

    1. Create a Force.com Site. Details, including "Creating a Force.com Site"
    2. Modify your Site's "Public Access Settings"
    3. Check "Read" access to "Survey" and "Survey Question" object.
    4. Check "Read" and "Create" access for "Surveys Taken" and "Survey Question Responses"
    5. Add the Visualforce page, "Take Survey" to the list of enabled Visualforce pages.

    Survey Connecting to Contact or Case Records

    1. Complete "General Surveys" steps.
    2. Check "Read" access for "Contact" object.
    3. Check "Read" access for "Case" object.
    4. Private OWD? Check this thread.
Note: This guide will help you how to use Surveyforce "Surveyforce User Guide"
https://appexchange.salesforce.com/servlet/servlet.FileDownload?file=00P3A00000VpvvJUAR



Step 2: Now create a relationship with Case object and Order Object. Create a Lookup field on Case object of Order Object.
and also Create Formula Field on Case







Note: In SurveyForce app Contact and Case object is default field to capture the survey input on contact or Case or both Object but not for the Custom object.


Step 3:  Now we need to show Order Number on survey form so that consumer can see for which order number he is submitting the survey. after Adding a field on Case Object now we need to do some changes in the Apex Class component and VF Page. This Apex class is the Part of Survey force App.


Apex class Name: ViewSurveyController 

This is the Apex Class change see line no. 17 add this line and line no 99 to 102
public string PrimaryOrderNo {get;set;}

List<Case> lstcases=[Select id, Order_Number__c from Case where id=:caseId];
            if(lstcases.size()>0){
            PrimaryOrderNo= lstcases[0].Order_Number__c;  
            }

1:  /* Controller associated with pages rendering the survey.  
2:   * Used by SurveyPage, ResultsPage, TakeSurvey  
3:   */  
4:  global virtual without sharing class ViewSurveyController {  
5:    public String qQuestion           {get; set;}  
6:   public Boolean qRequired           {get; set;}  
7:   public String qChoices            {get; set;}  
8:    public String surveyName            {get; set;}  
9:    public String surveyHeader        {get; set;}  
10:    public String surveyId             {get;   
11:      set{  
12:        this.surveyId = value;  
13:        init();  
14:      }  
15:    }    
16:    public String renderSurveyPreview      {get; set;}  
17:    public string PrimaryOrderNo                              {get;set;}  
18:    public String questionName          {get; set;}   
19:    public String questionType          {get; set;}  
20:    public Boolean questionRequired       {get; set;}  
21:   public List<SelectOption> singleOptions  {get; set;}   
22:    public List<SFQuestion> allQuestions    {get; set;}  
23:    public List<String> responses          {get; set;}  
24:    public Integer allQuestionsSize        {get; set;}  
25:    public String templateURL        {get; set;}  
26:    public String surveyThankYouText     {get; set;}  
27:    public String surveyContainerCss {get; set;}  
28:    public String surveyThankYouURL     {get; set;}  
29:   public String caseId           {get; set;}  
30:   public String contactId {get;set;}  
31:    public String anonymousAnswer {get;set;}  
32:    public List<SelectOption> anonymousOrUser {get;set;}  
33:    public Boolean isInternal {get;set;}  
34:    public String baseURL {get;set;}  
35:    public String userId{get;set;}  
36:    public String userName{get;set;}  
37:    public String surveyTakerId {get;set;}  
38:    public Boolean thankYouRendered{get;set;}  
39:    public List<String> newOrder {get;set;}  
40:    /* Retrieves the list of questions, the survey name, after retrieving the   
41:      necessary parameters from the url.  
42:    */  
43:   //------------------------------------------------------------------------------//   
44:    public ViewSurveyController(ApexPages.StandardController stdController) {  
45:      // Get url parameters  
46:      surveyId = Apexpages.currentPage().getParameters().get('id');  
47:      caseId  = Apexpages.currentPage().getParameters().get('caId');  
48:      contactId = Apexpages.currentPage().getParameters().get('cId');   
49:      if(caseId ==null || caseId.length()<15){  
50:        caseId = 'none';  
51:      }  
52:      if(contactId ==null || contactId.length()<15){  
53:        contactId = 'none';  
54:      }        
55:      // By default the preview is not showing up  
56:      renderSurveyPreview = 'false';  
57:      init();  
58:    }   
59:    public ViewSurveyController(viewShareSurveyComponentController controller)  
60:    {  
61:      surveyId = Apexpages.currentPage().getParameters().get('id');  
62:      caseId  = Apexpages.currentPage().getParameters().get('caId');  
63:      contactId = Apexpages.currentPage().getParameters().get('cId');   
64:      if(caseId ==null || caseId.length()<15){  
65:        caseId = 'none';  
66:      }  
67:      if(contactId ==null || contactId.length()<15){  
68:        contactId = 'none';  
69:      }      
70:      // By default the preview is not showing up  
71:      renderSurveyPreview = 'false';  
72:      init();  
73:    }  
74:    public void init()  
75:    {  
76:      if (surveyId != null){   
77:        // Retrieve all necessary information to be displayed on the page  
78:        allQuestions = new List<SFQuestion>();  
79:        setupQuestionList();  
80:        setSurveyNameAndThankYou(surveyId);  
81:        anonymousOrUser = new List<SelectOption>();  
82:        anonymousOrUser.add(new SelectOption('Anonymous',System.Label.LABS_SF_Anonymous));  
83:        anonymousOrUser.add(new SelectOption('User','User ' + UserInfo.getFirstName() + ' ' + UserInfo.getLastName()));  
84:        anonymousAnswer = 'Anonymous';  
85:        isInternal =true;  
86:        newOrder = new List<String>();  
87:        String urlBase = URL.getSalesforceBaseUrl().toExternalForm();  
88:        baseURL = urlBase;  
89:        userId = UserInfo.getUserId();  
90:        userName = UserInfo.getName();  
91:        List<Case> lstcases=[Select id, Order_Number__c from Case where id=:caseId];  
92:        if(lstcases.size()>0){  
93:             PrimaryOrderNo= lstcases[0].Order_Number__c;   
94:        }  
95:        String profileId = UserInfo.getProfileId();  
96:        try  
97:        {  
98:          Profile p = [select Id, UserType from Profile where Id=:profileId];  
99:          if (p.UserType == 'Guest')  
100:          {  
101:            isInternal = false;  
102:          }  
103:          else  
104:          {  
105:            isInternal = true;  
106:          }  
107:        }  
108:        catch (Exception e){  
109:          isInternal = false;  
110:        }  
111:        thankYouRendered=false;  
112:      }      
113:    }  
114:  //----------------------------------------------------------------------------//    
115:    /* Called during the setup of the page.   
116:      Retrieve questions and responses from DB and inserts them in 2 lists. */  
117:    public Integer setupQuestionList(){  
118:      getAQuestion();  
119:      return allQuestions.size();  
120:    }  
121:    /** Sets the survey's name variable  
122:    * param: sID  The survey ID as specified in the DB  
123:    */  
124:    public void setSurveyNameAndThankYou(String sId){  
125:      Survey__c s = [SELECT Name, Id, URL__c, Thank_You_Text__c, thankYouText__c, thankYouLink__c, Survey_Header__c, Survey_Container_CSS__c FROM Survey__c WHERE Id =:sId];  
126:      surveyName = s.Name;  
127:      surveyHeader = s.Survey_Header__c;  
128:      templateURL = s.URL__c+'id='+sId;//+'&cId={!Contact.Id}'+'&caId='+'{!Case.id}';  
129:      surveyThankYouText = s.Thank_You_Text__c;  
130:      if (surveyThankYouText == null)  
131:      {  
132:        surveyThankYouText = System.Label.LABS_SF_Survey_Submitted_Thank_you;  
133:      }  
134:      surveyThankYouURL = s.thankYouLink__c;  
135:      surveyContainerCss = s.Survey_Container_CSS__c;  
136:    }  
137:  //------------------------------------------------------------------------------//    
138:   public Pagereference updateSurveyName(){  
139:     Survey__c s = [SELECT Name, Id, URL__c, thankYouText__c, thankYouLink__c FROM Survey__c WHERE Id =:surveyId];  
140:     s.Name = surveyName;  
141:     try{  
142:      update s;  
143:     }catch (Exception e){  
144:      Apexpages.addMessages(e);  
145:     }  
146:     return null;  
147:   }   
148:  //------------------------------------------------------------------------------//     
149:    public Pagereference updateSurveyThankYouAndLink(){  
150:      Survey__c s = [SELECT Name, Id, URL__c, thankYouText__c, thankYouLink__c FROM Survey__c WHERE Id =:surveyId];  
151:      s.thankYouText__c = surveyThankYouText;  
152:      s.thankYouLink__c = surveyThankYouURL;  
153:      try{  
154:        update s;  
155:      }catch(Exception e){  
156:        Apexpages.addMessages(e);  
157:      }  
158:      return null;  
159:    }  
160:   //------------------------------------------------------------------------------//    
161:   /** When requested from the page - when the user clicks on 'Update Order' -  
162:     this function will reorganize the list so that it is displayed in the new order  
163:    */  
164:    public Pagereference refreshQuestionList(){  
165:    setupQuestionList();  
166:    return null;  
167:    }  
168:  //------------------------------------------------------------------------------//     
169:  //------------------------------------------------------------------------------//    
170:   private static boolean checkRequired(String response, Survey_Question__c question){  
171:    if(question.Required__c == true){  
172:      if(response == null || response =='NO RESPONSE')  
173:       return false;  
174:    }  
175:    return true;  
176:   }   
177:    /** Redirects the page that displays the detailed results of the survey,   
178:      from all users who took the survey.  
179:    */  
180:    public PageReference resultPage() {  
181:      return new PageReference('/apex/ResultsPage?id='+surveyId);  
182:    }  
183:  //------------------------------------------------------------------------------//   
184:  //------------------------------------------------------------------------------//   
185:    /**   
186:    */  
187:    public List<String> getResponses() {  
188:      List<SurveyQuestionResponse__c> qr = [Select Survey_Question__c, SurveyTaker__c, Response__c, Name From SurveyQuestionResponse__c limit 100];  
189:      List<String> resp = new List<String>();  
190:      for (SurveyQuestionResponse__c r : qr) {  
191:        resp.add(r.Response__c);  
192:      }  
193:      return resp;  
194:    }   
195:   /** Fills up the List of questions to be displayed on the Visualforce page  
196:    */    
197:    public List<SFQuestion> getAQuestion() {  
198:        qQuestion = '';  
199:        qChoices ='';  
200:      List<Survey_Question__c> allQuestionsObject =   
201:                      [Select s.Type__c, s.Id, s.Survey__c, s.Required__c, s.Question__c,   
202:                      s.OrderNumber__c, s.Name, s.Choices__c   
203:                      From Survey_Question__c s   
204:                      WHERE s.Survey__c =: surveyId ORDER BY s.OrderNumber__c];  
205:      System.debug(allQuestionsObject);  
206:      allQuestions = new List<SFQuestion>();  
207:      Double old_OrderNumber = 0;  
208:      Double new_OrderNumber;  
209:      Double difference = 0;  
210:      /* Make sure that the order number follow each other (after deleting a question, orders might not do so) */  
211:      for (Survey_Question__c q : allQuestionsObject){   
212:        new_OrderNumber = q.OrderNumber__c;  
213:        difference = new_OrderNumber - old_OrderNumber - 1;  
214:        if (difference > 0) {  
215:          Double dd = double.valueOf(difference);  
216:          Integer newOrderInt = dd.intValue();  
217:          q.OrderNumber__c -= Integer.valueOf(newOrderInt);   
218:        }  
219:        old_OrderNumber = q.OrderNumber__c;  
220:        SFQuestion theQ = new SFQuestion(q);  
221:        allQuestions.add(theQ);  
222:      }  
223:      allQuestionsSize = allQuestions.size();  
224:      return allQuestions;  
225:    }    
226:    public void submitResults()  
227:    {  
228:      try {  
229:        List <SurveyQuestionResponse__c> sqrList = new List<SurveyQuestionResponse__c>();  
230:        System.debug('Here 1');  
231:        for (SFQuestion q : allQuestions) {  
232:          System.debug('Here 2');  
233:          SurveyQuestionResponse__c sqr = new SurveyQuestionResponse__c();  
234:          if (q.renderSelectRadio == 'true') {  
235:            if (q.required && (q.selectedOption == null || q.selectedOption == '')) {  
236:              Apexpages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, 'Please fill out all required fields'));  
237:              return;  
238:            }  
239:            if (q.selectedOption == null || q.selectedOption == '') {  
240:              sqr.Response__c = '';  
241:            } else {  
242:              sqr.Response__c = q.singleOptions.get(Integer.valueOf(q.selectedOption)).getLabel();  
243:            }  
244:            sqr.Survey_Question__c = q.Id;  
245:            sqrList.add(sqr);  
246:          } else if (q.renderFreeText == 'true') {  
247:            if (q.required && q.choices == '') {  
248:              Apexpages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, 'Please fill out all required fields'));  
249:              return;  
250:            }  
251:            System.debug('*****Select Radio ' + q.choices);  
252:            sqr.Response__c = q.choices;  
253:            sqr.Survey_Question__c = q.Id;  
254:            sqrList.add(sqr);  
255:          } else if (q.renderSelectCheckboxes == 'true') {  
256:            if (q.required && (q.selectedOptions == null || q.selectedOptions.size() == 0)) {  
257:              Apexpages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, 'Please fill out all required fields'));  
258:              return;  
259:            }  
260:            for (String opt : q.selectedOptions) {  
261:              sqr = new SurveyQuestionResponse__c();  
262:              if (opt == '' || opt == null) {  
263:                sqr.Response__c = '';  
264:              } else {  
265:                sqr.Response__c = q.multiOptions.get(Integer.valueOf(opt)).getLabel();  
266:              }  
267:              sqr.Survey_Question__c = q.Id;  
268:              sqrList.add(sqr);  
269:            }  
270:          } else if (q.renderSelectRow == 'true') {  
271:            if (q.required && (q.selectedOption == null || q.selectedOption == '')) {  
272:              Apexpages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, 'Please fill out all required fields'));  
273:              return;  
274:            }  
275:            if (q.selectedOption == null || q.selectedOption == '') {  
276:              sqr.Response__c = '';  
277:            } else {  
278:              sqr.Response__c = q.rowOptions.get(Integer.valueOf(q.selectedOption)).getLabel();  
279:            }  
280:            sqr.Survey_Question__c = q.Id;  
281:            sqrList.add(sqr);  
282:          }  
283:        }  
284:        if(AddSurveyTaker())  
285:        {  
286:          System.debug('Here 3');  
287:          for (SurveyQuestionResponse__c sqr : sqrList)  
288:          {  
289:            sqr.SurveyTaker__c = surveyTakerId;  
290:          }  
291:          System.debug('Here 4');  
292:          insert sqrList;  
293:          thankYouRendered=true;  
294:        }  
295:      }catch(Exception e){  
296:        if(isInternal) {  
297:          Apexpages.addMessages(e);  
298:        }else{  
299:          System.debug('Exception: ' + e.getMessage());  
300:          Apexpages.addMessage(new ApexPages.Message(ApexPages.Severity.Error, 'Some error occured while saving response'));  
301:        }  
302:      }  
303:    }  
304:    private Boolean AddSurveyTaker()  
305:    {  
306:      String userId;  
307:      if (surveyId == null)  
308:      {  
309:        return false;  
310:      }  
311:      if(caseId.toUpperCase() =='NONE'|| caseId.length()<5)  
312:       caseId = null;    
313:      if(contactId.toUpperCase() =='NONE'|| contactId.length()<5)  
314:       contactId = null;       
315:      if (anonymousAnswer != 'Anonymous')  
316:      {  
317:        userId = UserInfo.getUserId();  
318:      }  
319:      else  
320:      {  
321:        userId = null;  
322:      }  
323:      if(anonymousAnswer != 'Anonymous' && (contactId != null || caseId != null))  
324:      {  
325:        List<SurveyTaker__c> check = [Select Contact__c, Survey__c, Case__c, User__c From SurveyTaker__c Where Contact__c=:contactId and Survey__c=:surveyId and Case__c = :caseId and User__c=:UserId];  
326:        if(check != null && check.size()>0){  
327:          Apexpages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, System.Label.LABS_SF_You_have_already_taken_this_survey));  
328:          return false;      
329:        }  
330:      }  
331:      SurveyTaker__c st = new SurveyTaker__c();  
332:      st.Contact__c = contactId;  
333:      st.Survey__c = surveyId;  
334:      st.Taken__c = 'false';  
335:      st.Case__c = caseId;  
336:      st.User__c = userId;  
337:      insert st;   
338:      surveyTakerId = st.Id;  
339:      return true;    
340:    }  
341:  }  

In VF Page : 
TakeSurvey

Add following changes to display Order Number
see line no 27 and add the same in VF Page.

<div class="slds-text-heading--medium">Order No: {!PrimaryOrderNo}</div>



1:  <apex:page standardcontroller="Survey__c" extensions="ViewSurveyController" cache="false" sidebar="false" showheader="false">  
2:    <apex:includeScript value="{! $Resource.SurveyForce_jquery}"/>  
3:    <!-- convertCheckBoxToLDS() is in surveyforce.js -->  
4:    <apex:includeScript value="{! $Resource.SurveyForce + '/surveyforce.js'}"/>  
5:    <apex:stylesheet value="{! $Resource.SurveyForce + '/surveyforce.css'}"/>  
6:    <apex:stylesheet value="{! $Resource.SurveyForce + '/surveyforce_pagemessage_override.css'}"/>  
7:    <apex:stylesheet value="{! $Resource.SurveyForce_SLDS + '/assets/styles/salesforce-lightning-design-system-vf.min.css'}"/>  
8:    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />  
9:    <script>  
10:      $(document).ready(function(){  
11:        //Convert any elements with "convertToLDS" style to SLDS styles  
12:        //Used in certain places where it's not easy to use SLDS for those elements like "apex:selectCheckboxes"  
13:        convertCheckBoxToLDS();  
14:      });  
15:    </script>  
16:    <!-- Custom CSS added by survey admin -->  
17:    <style>  
18:      <apex:outputText value="{!HTMLENCODE(surveyContainerCss)}" escape="false"/>  
19:    </style>  
20:    <div id="survey_container" class="surveyforce">  
21:      <apex:form id="theForm"  >  
22:        <apex:outputPanel id="seeSurvey" rendered="{! If((Survey__c.Hide_Survey_Name__c == false || Survey__c.Survey_Header__c != ''), True, False )}" >  
23:          <div class="slds-box slds-theme--shade">  
24:            <div class="slds-text-heading--large"><apex:outputText value="{!Survey__c.Survey_Header__c}" escape="false" /> </div>  
25:            <apex:outputPanel rendered="{!Survey__c.Hide_Survey_Name__c == false}">  
26:              <div class="slds-text-heading--medium">{!Survey__c.Name}</div>  
27:              <div class="slds-text-heading--medium">Order No: {!PrimaryOrderNo}</div>  
28:            </apex:outputPanel>  
29:          </div>  
30:        </apex:outputPanel>  
31:        <script>  
32:          $(document).ready(function(){  
33:            overridePageMessages();  
34:          });  
35:        </script>  
36:        <apex:pageMessages />  
37:        <c:uiMessage severity="success" message="{!surveyThankYouText}" renderMe="{!thankYouRendered == true}" />  
38:        <apex:outputPanel rendered="{!thankYouRendered == false}">  
39:          <div class="slds-form--stacked">  
40:            <apex:repeat value="{!allQuestions}" var="qPreview" id="aQPreview">  
41:              <div class="slds-box slds-theme--default">  
42:                <div class="slds-form-element">  
43:                  <label class="slds-form-element__label">  
44:                      {!qPreview.orderNumber + ': ' + qPreview.question}  
45:                      <apex:outputText rendered="{! qPreview.required}" value="({!$Label.LABS_SF_Required})" />  
46:                  </label>  
47:                </div>  
48:                <apex:outputPanel rendered="{!qPreview.renderSelectRadio}">  
49:                  <apex:selectRadio styleClass="convertToLDS" layout="pageDirection" rendered="{!qPreview.renderSelectRadio}" value="{!qPreview.selectedOption}" >  
50:                    <apex:selectOptions value="{!qPreview.singleOptions}"/>  
51:                  </apex:selectRadio>  
52:                </apex:outputPanel>  
53:                <apex:outputPanel rendered="{!qPreview.renderSelectCheckboxes}">  
54:                  <apex:selectCheckboxes styleClass="convertToLDS" layout="pageDirection" rendered="{!qPreview.renderSelectCheckboxes}" value="{!qPreview.selectedOptions}" >  
55:                    <apex:selectOptions value="{!qPreview.multiOptions}"/>  
56:                  </apex:selectCheckboxes>  
57:                </apex:outputPanel>  
58:                <apex:outputPanel rendered="{!qPreview.renderFreeText}">  
59:                  <div class="slds-form-element">  
60:                    <div class="slds-form-element__control" >  
61:                      <apex:inputTextArea styleClass="slds-textarea" cols="" rows="{!qPreview.noOfRowsForTextArea}" rendered="{!qPreview.renderFreeText}" value="{!qPreview.choices}"/>  
62:                    </div>  
63:                  </div>  
64:                </apex:outputPanel>  
65:                <apex:outputPanel rendered="{!qPreview.renderSelectRow}">  
66:                  <apex:selectRadio styleClass="convertToLDS" rendered="{!qPreview.renderSelectRow}" value="{!qPreview.selectedOption}">  
67:                    <apex:selectOptions value="{!qPreview.rowOptions}"/>  
68:                  </apex:selectRadio>  
69:                </apex:outputPanel>  
70:              </div>  
71:            </apex:repeat>  
72:          </div>  
73:        </apex:outputPanel>  
74:        <apex:outputPanel rendered="{!thankYouRendered == false}">  
75:          <div class="slds-box slds-theme--default">  
76:            <apex:outputPanel rendered="{!isInternal}" >  
77:                <span class="slds-text-body--regular">{!$Label.LABS_SF_Answer_as}:</span>  
78:                <apex:selectRadio styleClass="convertToLDS" value="{!anonymousAnswer}">  
79:                  <apex:selectOptions value="{!anonymousOrUser}" />  
80:                  <apex:actionSupport event="onchange" rerender="hiddenAnonymousAnswer"/>  
81:                </apex:selectRadio>  
82:                <apex:inputHidden value="{!anonymousAnswer}" id="hiddenAnonymousAnswer"/>  
83:                <br />  
84:            </apex:outputPanel>  
85:            <apex:commandButton styleClass="slds-button slds-button--brand" action="{!submitResults}" value="{!$Label.LABS_SF_SubmitSurvey}" rerender="theForm,seeSurvey" />  
86:          </div>  
87:        </apex:outputPanel>  
88:      </apex:form>  
89:    </div>  
90:  </apex:page>  
Step 4:  We have to write a Process Builder to generate Case/Create Case once order stage is Changed to Delivered. we will also populate the Order Lookup field on Case while creating Case Record.

See Salesforce for more detail


Step 5: Now we have to generate the Survey Link and create email template as well as create Workflow rule send the Survey link to Contact Person. This email alert we have to write on Case Object.


  • Open the surveyforce app
  • Choose Surveys Tab
  • Select required Surveys that you have created.

  • Choose an appropriate site and copy the link to Further use in email template. 
Create Email Template on Case and update Email body with that Survey Link. See Below.


Write a workflow rule email alert.


END.

Survey Form will look like this





Hiccups and Solution:
1. Header and Image was not displaying while opening Survey Link
Solution: Open guest profile user and add all Field level security Read only for Survey Taken and Survey Object.

For further query please email us at amulhai@gmail.com



Wednesday, 10 January 2018

Close the action panel | dismiss Action Panel | dismiss action component popup

dismiss action component popup using javascript in Lightning

Component Name:
ListBuilder.cmp


 <aura:component implements="force:lightningQuickAction" >  
   <div class="demo-only" style="height: 640px;" aura:id="MainDiv">  
     <section role="dialog" tabindex="-1" class="slds-modal slds-fade-in-open slds-modal_large" aria-labelledby="id-of-modalheader-h2" aria-modal="true" aria-describedby="modal-content-id-1">  
       <div class="slds-modal__container">  
         <header class="slds-modal__header">  
           <button class="slds-button slds-button_icon slds-modal__close slds-button_icon-inverse" title="Close" onclick="{!c.cancelBtn}">  
             <!--<svg class="slds-button__icon slds-button__icon_large" aria-hidden="true">  
               <use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="/assets/icons/utility-sprite/svg/symbols.svg#close" />  
             </svg>-->  
             <lightning:icon iconName="utility:close" class="slds-button__icon slds-button__icon_large"/>  
             <span class="slds-assistive-text">Close</span>  
           </button>  
           <!--<lightning:button variant="inverse" label="Close" iconName="utility:close" iconPosition="left" onclick="{! c.handleClick }" />  
           -->  
           <h2 id="id-of-modalheader-h2" class="slds-text-heading_medium">Add Products</h2>  
           <p class="slds-m-top_x-small">Pricebook: Salesforce Products</p>  
         </header>  
         <div class="slds-modal__content slds-grid slds-nowrap" id="modal-content-id-1">  
           <div class="slds-col slds-grid slds-grid_vertical slds-nowrap">  
             <div class="slds-p-vertical_x-small slds-p-horizontal_large slds-shrink-none slds-theme_shade">  
               <div class="slds-form-element">  
                 <label class="slds-form-element__label slds-assistive-text" for="combobox-unique-id">Search</label>  
                 <div class="slds-form-element__control">  
                   <div class="slds-combobox_container">  
                     <div class="slds-combobox slds-dropdown-trigger slds-dropdown-trigger_click" aria-expanded="false" aria-haspopup="listbox" role="combobox">  
                       <div class="slds-combobox__form-element slds-input-has-icon slds-input-has-icon_right" role="none">  
                         <input type="text" class="slds-input slds-combobox__input" id="combobox-unique-id" aria-autocomplete="list" aria-controls="listbox-unique-id" autocomplete="off" role="textbox" placeholder="Search Salesforce" />  
                         <span class="slds-icon_container slds-icon-utility-search slds-input__icon slds-input__icon_right">  
                           <!-- <svg class="slds-icon slds-icon slds-icon_x-small slds-icon-text-default" aria-hidden="true">  
                             <use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="/assets/icons/utility-sprite/svg/symbols.svg#search" />  
                           </svg>-->  
                           <lightning:icon iconName="utility:search" class="slds-icon slds-icon slds-icon_x-small slds-icon-text-default"/>  
                         </span>  
                       </div>  
                       <div id="listbox-unique-id" role="listbox">  
                         <ul class="slds-listbox slds-listbox_vertical slds-dropdown slds-dropdown_fluid" role="presentation">  
                           <li role="presentation" class="slds-listbox__item">  
                             <span id="listbox-option-unique-id-01" class="slds-media slds-listbox__option slds-listbox__option_entity slds-listbox__option_has-meta" role="option">  
                               <span class="slds-media__figure">  
                                 <span class="slds-icon_container slds-icon-standard-account" title="Description of icon when needed">  
                                   <!--<svg class="slds-icon slds-icon_small" aria-hidden="true">  
                                     <use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="/assets/icons/standard-sprite/svg/symbols.svg#account" />  
                                   </svg>-->  
                                   <lightning:icon iconName="standard:account" class="slds-icon slds-icon_small"/>  
                                   <span class="slds-assistive-text">Description of icon</span>  
                                 </span>  
                               </span>  
                               <span class="slds-media__body">  
                                 <span class="slds-listbox__option-text slds-listbox__option-text_entity">Acme</span>  
                                 <span class="slds-listbox__option-meta slds-listbox__option-meta_entity">Account • San Francisco</span>  
                               </span>  
                             </span>  
                           </li>  
                           <li role="presentation" class="slds-listbox__item">  
                             <span id="listbox-option-unique-id-02" class="slds-media slds-listbox__option slds-listbox__option_entity slds-listbox__option_has-meta" role="option">  
                               <span class="slds-media__figure">  
                                 <span class="slds-icon_container slds-icon-standard-account" title="Description of icon when needed">  
                                   <!--<svg class="slds-icon slds-icon_small" aria-hidden="true">  
                                     <use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="/assets/icons/standard-sprite/svg/symbols.svg#account" />  
                                   </svg>-->  
                                   <lightning:icon iconName="standard:account" class="slds-icon slds-icon_small"/>  
                                   <span class="slds-assistive-text">Description of icon</span>  
                                 </span>  
                               </span>  
                               <span class="slds-media__body">  
                                 <span class="slds-listbox__option-text slds-listbox__option-text_entity">Salesforce.com, Inc.</span>  
                                 <span class="slds-listbox__option-meta slds-listbox__option-meta_entity">Account • San Francisco</span>  
                               </span>  
                             </span>  
                           </li>  
                         </ul>  
                       </div>  
                     </div>  
                   </div>  
                 </div>  
               </div>  
               <div class="slds-pill_container slds-pill_container_bare">  
                 <div id="listbox-unique-id" role="listbox">  
                   <ul class="slds-listbox" role="presentation">  
                     <li role="presentation" class="slds-listbox__item">  
                       <span class="slds-pill" role="option" tabindex="0" aria-selected="true">  
                         <span class="slds-pill__label" title="Analytics">Analytics</span>  
                         <span class="slds-icon_container slds-pill__remove" title="Remove">  
                           <!--<svg class="slds-icon slds-icon_x-small slds-icon-text-default" aria-hidden="true">  
                             <use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="/assets/icons/utility-sprite/svg/symbols.svg#close" />  
                           </svg>-->  
                           <lightning:icon iconName="utility:close" class="slds-icon slds-icon_x-small slds-icon-text-default"/>  
                           <span class="slds-assistive-text">Press delete or backspace to remove</span>  
                         </span>  
                       </span>  
                     </li>  
                   </ul>  
                 </div>  
               </div>  
               <div class="slds-text-title slds-m-top_x-small" aria-live="polite">1 Item(s) Selected</div>  
             </div>  
             <div class="slds-scrollable slds-grow">  
               <table role="grid" class="slds-table slds-table_fixed-layout slds-table_bordered slds-table_resizable-cols slds-no-row-hover slds-scrollable_none">  
                 <thead>  
                   <tr class="slds-line-height_reset">  
                     <th scope="col" style="width: 3.75rem;"></th>  
                     <th aria-label="Name" aria-sort="none" class="slds-is-sortable slds-is-resizable slds-text-title_caps" scope="col">  
                       <a class="slds-th__action slds-text-link_reset" href="javascript:void(0);" role="button" tabindex="-1">  
                         <span class="slds-assistive-text">Sort by: </span>  
                         <span class="slds-truncate" title="Name">Name</span>  
                         <div class="slds-icon_container">  
                           <!-- <svg class="slds-icon slds-icon_x-small slds-icon-text-default slds-is-sortable__icon" aria-hidden="true">  
                             <use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="/assets/icons/utility-sprite/svg/symbols.svg#arrowdown" />  
                           </svg>-->  
                           <lightning:icon iconName="utility:arrowdown" class="slds-icon slds-icon_x-small slds-icon-text-default slds-is-sortable__icon"/>  
                         </div>  
                       </a>  
                       <span class="slds-assistive-text" aria-live="assertive" aria-atomic="true">Sorted none</span>  
                       <div class="slds-resizable">  
                         <input type="range" min="20" max="1000" aria-label="Name column width" class="slds-resizable__input slds-assistive-text" id="cell-resize-handle-17" tabindex="-1" />  
                         <span class="slds-resizable__handle">  
                           <span class="slds-resizable__divider"></span>  
                         </span>  
                       </div>  
                     </th>  
                     <th aria-label="Product Code" aria-sort="none" class="slds-is-sortable slds-is-resizable slds-text-title_caps" scope="col">  
                       <a class="slds-th__action slds-text-link_reset" href="javascript:void(0);" role="button" tabindex="-1">  
                         <span class="slds-assistive-text">Sort by: </span>  
                         <span class="slds-truncate" title="Product Code">Product Code</span>  
                         <div class="slds-icon_container">  
                           <!-- <svg class="slds-icon slds-icon_x-small slds-icon-text-default slds-is-sortable__icon" aria-hidden="true">  
                             <use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="/assets/icons/utility-sprite/svg/symbols.svg#arrowdown" />  
                           </svg>-->  
                           <lightning:icon iconName="utility:arrowdown" class="slds-icon slds-icon_x-small slds-icon-text-default slds-is-sortable__icon"/>  
                         </div>  
                       </a>  
                       <span class="slds-assistive-text" aria-live="assertive" aria-atomic="true">Sorted none</span>  
                       <div class="slds-resizable">  
                         <input type="range" min="20" max="1000" aria-label="Product Code column width" class="slds-resizable__input slds-assistive-text" id="cell-resize-handle-18" tabindex="-1" />  
                         <span class="slds-resizable__handle">  
                           <span class="slds-resizable__divider"></span>  
                         </span>  
                       </div>  
                     </th>  
                     <th aria-label="List Price" aria-sort="none" class="slds-is-sortable slds-is-resizable slds-text-title_caps" scope="col">  
                       <a class="slds-th__action slds-text-link_reset" href="javascript:void(0);" role="button" tabindex="-1">  
                         <span class="slds-assistive-text">Sort by: </span>  
                         <span class="slds-truncate" title="List Price">List Price</span>  
                         <div class="slds-icon_container">  
                           <!--<svg class="slds-icon slds-icon_x-small slds-icon-text-default slds-is-sortable__icon" aria-hidden="true">  
                             <use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="/assets/icons/utility-sprite/svg/symbols.svg#arrowdown" />  
                           </svg>-->  
                           <lightning:icon iconName="utility:arrowdown" class="slds-icon slds-icon_x-small slds-icon-text-default slds-is-sortable__icon"/>  
                         </div>  
                       </a>  
                       <span class="slds-assistive-text" aria-live="assertive" aria-atomic="true">Sorted none</span>  
                       <div class="slds-resizable">  
                         <input type="range" min="20" max="1000" aria-label="List Price column width" class="slds-resizable__input slds-assistive-text" id="cell-resize-handle-19" tabindex="-1" />  
                         <span class="slds-resizable__handle">  
                           <span class="slds-resizable__divider"></span>  
                         </span>  
                       </div>  
                     </th>  
                     <th aria-label="Product Family" aria-sort="none" class="slds-is-sortable slds-is-resizable slds-text-title_caps" scope="col">  
                       <a class="slds-th__action slds-text-link_reset" href="javascript:void(0);" role="button" tabindex="-1">  
                         <span class="slds-assistive-text">Sort by: </span>  
                         <span class="slds-truncate" title="Product Family">Product Family</span>  
                         <div class="slds-icon_container">  
                           <!-- <svg class="slds-icon slds-icon_x-small slds-icon-text-default slds-is-sortable__icon" aria-hidden="true">  
                             <use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="/assets/icons/utility-sprite/svg/symbols.svg#arrowdown" />  
                           </svg>-->  
                           <lightning:icon iconName="utility:arrowdown" class="slds-icon slds-icon_x-small slds-icon-text-default slds-is-sortable__icon"/>  
                         </div>  
                       </a>  
                       <span class="slds-assistive-text" aria-live="assertive" aria-atomic="true">Sorted none</span>  
                       <div class="slds-resizable">  
                         <input type="range" min="20" max="1000" aria-label="Product Family column width" class="slds-resizable__input slds-assistive-text" id="cell-resize-handle-20" tabindex="-1" />  
                         <span class="slds-resizable__handle">  
                           <span class="slds-resizable__divider"></span>  
                         </span>  
                       </div>  
                     </th>  
                   </tr>  
                 </thead>  
                 <tbody>  
                   <tr class="slds-hint-parent" aria-selected="true">  
                     <td role="gridcell" tabindex="0" class="slds-text-align_right" style="width: 3.75rem;">  
                       <div class="slds-checkbox_add-button">  
                         <input type="checkbox" class="slds-assistive-text" id="add-checkbox-26" tabindex="-1" value="on" />  
                         <label for="add-checkbox-26" class="slds-checkbox_faux">  
                           <span class="slds-assistive-text">Select item 1</span>  
                         </label>  
                       </div>  
                     </td>  
                     <th scope="row">  
                       <div class="slds-truncate" title="Analytics">Analytics</div>  
                     </th>  
                     <td role="gridcell">  
                       <div class="slds-truncate" title="ANTLY">ANTLY</div>  
                     </td>  
                     <td role="gridcell">  
                       <div class="slds-truncate" title="5000.00">5000.00</div>  
                     </td>  
                     <td role="gridcell">  
                       <div class="slds-truncate" title="Analytics Product">Analytics Product</div>  
                     </td>  
                   </tr>  
                   <tr class="slds-hint-parent">  
                     <td role="gridcell" tabindex="-1" class="slds-text-align_right" style="width: 3.75rem;">  
                       <div class="slds-checkbox_add-button">  
                         <input type="checkbox" class="slds-assistive-text" id="add-checkbox-27" tabindex="-1" value="on" />  
                         <label for="add-checkbox-27" class="slds-checkbox_faux">  
                           <span class="slds-assistive-text">Select item 2</span>  
                         </label>  
                       </div>  
                     </td>  
                     <th scope="row">  
                       <div class="slds-truncate" title="Analytics">Analytics</div>  
                     </th>  
                     <td role="gridcell">  
                       <div class="slds-truncate" title="ANTLY">ANTLY</div>  
                     </td>  
                     <td role="gridcell">  
                       <div class="slds-truncate" title="5000.00">5000.00</div>  
                     </td>  
                     <td role="gridcell">  
                       <div class="slds-truncate" title="Analytics Product">Analytics Product</div>  
                     </td>  
                   </tr>  
                   <tr class="slds-hint-parent">  
                     <td role="gridcell" tabindex="-1" class="slds-text-align_right" style="width: 3.75rem;">  
                       <div class="slds-checkbox_add-button">  
                         <input type="checkbox" class="slds-assistive-text" id="add-checkbox-28" tabindex="-1" value="on" />  
                         <label for="add-checkbox-28" class="slds-checkbox_faux">  
                           <span class="slds-assistive-text">Select item 3</span>  
                         </label>  
                       </div>  
                     </td>  
                     <th scope="row">  
                       <div class="slds-truncate" title="Analytics">Analytics</div>  
                     </th>  
                     <td role="gridcell">  
                       <div class="slds-truncate" title="ANTLY">ANTLY</div>  
                     </td>  
                     <td role="gridcell">  
                       <div class="slds-truncate" title="5000.00">5000.00</div>  
                     </td>  
                     <td role="gridcell">  
                       <div class="slds-truncate" title="Analytics Product">Analytics Product</div>  
                     </td>  
                   </tr>  
                   <tr class="slds-hint-parent">  
                     <td role="gridcell" tabindex="-1" class="slds-text-align_right" style="width: 3.75rem;">  
                       <div class="slds-checkbox_add-button">  
                         <input type="checkbox" class="slds-assistive-text" id="add-checkbox-29" tabindex="-1" value="on" />  
                         <label for="add-checkbox-29" class="slds-checkbox_faux">  
                           <span class="slds-assistive-text">Select item 4</span>  
                         </label>  
                       </div>  
                     </td>  
                     <th scope="row">  
                       <div class="slds-truncate" title="Analytics">Analytics</div>  
                     </th>  
                     <td role="gridcell">  
                       <div class="slds-truncate" title="ANTLY">ANTLY</div>  
                     </td>  
                     <td role="gridcell">  
                       <div class="slds-truncate" title="5000.00">5000.00</div>  
                     </td>  
                     <td role="gridcell">  
                       <div class="slds-truncate" title="Analytics Product">Analytics Product</div>  
                     </td>  
                   </tr>  
                   <tr class="slds-hint-parent">  
                     <td role="gridcell" tabindex="-1" class="slds-text-align_right" style="width: 3.75rem;">  
                       <div class="slds-checkbox_add-button">  
                         <input type="checkbox" class="slds-assistive-text" id="add-checkbox-30" tabindex="-1" value="on" />  
                         <label for="add-checkbox-30" class="slds-checkbox_faux">  
                           <span class="slds-assistive-text">Select item 5</span>  
                         </label>  
                       </div>  
                     </td>  
                     <th scope="row">  
                       <div class="slds-truncate" title="Analytics">Analytics</div>  
                     </th>  
                     <td role="gridcell">  
                       <div class="slds-truncate" title="ANTLY">ANTLY</div>  
                     </td>  
                     <td role="gridcell">  
                       <div class="slds-truncate" title="5000.00">5000.00</div>  
                     </td>  
                     <td role="gridcell">  
                       <div class="slds-truncate" title="Analytics Product">Analytics Product</div>  
                     </td>  
                   </tr>  
                   <tr class="slds-hint-parent">  
                     <td role="gridcell" tabindex="-1" class="slds-text-align_right" style="width: 3.75rem;">  
                       <div class="slds-checkbox_add-button">  
                         <input type="checkbox" class="slds-assistive-text" id="add-checkbox-31" tabindex="-1" value="on" />  
                         <label for="add-checkbox-31" class="slds-checkbox_faux">  
                           <span class="slds-assistive-text">Select item 6</span>  
                         </label>  
                       </div>  
                     </td>  
                     <th scope="row">  
                       <div class="slds-truncate" title="Analytics">Analytics</div>  
                     </th>  
                     <td role="gridcell">  
                       <div class="slds-truncate" title="ANTLY">ANTLY</div>  
                     </td>  
                     <td role="gridcell">  
                       <div class="slds-truncate" title="5000.00">5000.00</div>  
                     </td>  
                     <td role="gridcell">  
                       <div class="slds-truncate" title="Analytics Product">Analytics Product</div>  
                     </td>  
                   </tr>  
                   <tr class="slds-hint-parent">  
                     <td role="gridcell" tabindex="-1" class="slds-text-align_right" style="width: 3.75rem;">  
                       <div class="slds-checkbox_add-button">  
                         <input type="checkbox" class="slds-assistive-text" id="add-checkbox-32" tabindex="-1" value="on" />  
                         <label for="add-checkbox-32" class="slds-checkbox_faux">  
                           <span class="slds-assistive-text">Select item 7</span>  
                         </label>  
                       </div>  
                     </td>  
                     <th scope="row">  
                       <div class="slds-truncate" title="Analytics">Analytics</div>  
                     </th>  
                     <td role="gridcell">  
                       <div class="slds-truncate" title="ANTLY">ANTLY</div>  
                     </td>  
                     <td role="gridcell">  
                       <div class="slds-truncate" title="5000.00">5000.00</div>  
                     </td>  
                     <td role="gridcell">  
                       <div class="slds-truncate" title="Analytics Product">Analytics Product</div>  
                     </td>  
                   </tr>  
                   <tr class="slds-hint-parent">  
                     <td role="gridcell" tabindex="-1" class="slds-text-align_right" style="width: 3.75rem;">  
                       <div class="slds-checkbox_add-button">  
                         <input type="checkbox" class="slds-assistive-text" id="add-checkbox-33" tabindex="-1" value="on" />  
                         <label for="add-checkbox-33" class="slds-checkbox_faux">  
                           <span class="slds-assistive-text">Select item 8</span>  
                         </label>  
                       </div>  
                     </td>  
                     <th scope="row">  
                       <div class="slds-truncate" title="Analytics">Analytics</div>  
                     </th>  
                     <td role="gridcell">  
                       <div class="slds-truncate" title="ANTLY">ANTLY</div>  
                     </td>  
                     <td role="gridcell">  
                       <div class="slds-truncate" title="5000.00">5000.00</div>  
                     </td>  
                     <td role="gridcell">  
                       <div class="slds-truncate" title="Analytics Product">Analytics Product</div>  
                     </td>  
                   </tr>  
                 </tbody>  
               </table>  
             </div>  
           </div>  
         </div>  
         <footer class="slds-modal__footer">  
           <button class="slds-button slds-button_neutral" onclick="{!c.cancelBtn}">Cancel</button>  
           <button class="slds-button slds-button_brand">Next</button>  
         </footer>  
       </div>  
     </section>  
     <div class="slds-backdrop slds-backdrop_open"></div>  
   </div>  
 </aura:component>  
ListBuilderController.js

below code line will dismiss the action button component popup.


 ({  
   cancelBtn : function(component, event, helper) {  
     //Close the action panel  
     var dismissActionPanel = $A.get("e.force:closeQuickAction");  
     dismissActionPanel.fire();  
   }  
 })  

Salesforce Spring ’18 Release Exam

Salesforce Certified Administrator - Spring '18 Release Exam Time Remaining: 27:42 Top of Form ...