Header Ads Widget

Field Level Security on Site || SFDC || INTERVIEW STUFF


Field Level Security on Site


Issue: We have faced the issue of field cannot see by Guest user in site form.

Technical Description:

   We had site form where any user can see and fill the form of Lead. We have created new field and add in this visual force page. However Guest User not able to see or fill this field value.

Solution:

   As sites come under got to Develop>Sites>Lead Generation etc. where Default Web Address is the visual force page and open in instance of sandbox/production with page like http://company.Test.cs3.force.com/LeadGenerationPage

We can see FLS of fields click on Public Access Setting and Click on Object and Tab or view Object. Search the fields which is created and set enable the checkbox of edit and create.

Developer is facing the issue of Authorization Required which occurred due to FLS setting of fields. To solve this issue we have to edit the fields and enable the edit/create/delete check boxes as per requirement or based on profile/role.

How do you use composition and define tags in templates

Question: How do you use composition and define tags in templates?

Answer:

  Composition tag used to embed template in our visual force page. Means we can create visual force having only form and page, controller tag and just used insert tag in this page. Another (where this is going to invoke the first template) visual force page defining this inserts tag by using composition tag.

     <apex: composition> tag must contains at least one or more <apex: define> tag. We can write in define output label, text fields etc. For example:

     <apex:page controller="CompositionController">

 <apex:composition template="{!myTemplate}">

  <apex:define name="First Name">

  <apex:outputLabel value="First Name"/>

  <apex:inputText id="fname" value="{!fname}"/>

 </apex:define>

            </apex:composition>

         </apex:page>



Another page:

<apex:page controller="CompositionController">

<apex:form >

 <apex:insert name="First Name"></apex:insert>

 <br/><br/>

</apex:form>

</apex:page>

Above example calls dynamic template name through getter define in controller.

Read data through XML from third party API

Use Case

We have to read data through XML from third party API and capture it in SFDC object as html formatted text.

Those texts are in html format with html tags embedded with it and when it is displayed over the standard details page, they display those HTML Tags.

Challenge comes in the case on how to remove the Html tags and represent the whole content as plain text.

I felt a requirement of a generic class which can be plugged to any SFDC Project, to any module where the business requirement is to replace and convert the html content to plain text body.

This is best suited for Salesforce data content shown as multi line texts.

Solution

Prepare a generic global class which can be plugged with any module and which would take the HTML Embedded text content as string as input parameter and return plain text.

Developed the following generic global class which can be plugged together with any module for any project where they require removing embedded tag and representing the content as simple text.

Global Class

/*

Post a Comment

0 Comments