• Tiwari Vedant
  • NEWBIE
  • 45 Points
  • Member since 2017
  • Associated Application Developer
  • BMC Software

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 8
    Questions
  • 10
    Replies
Page dont load when you use init handler in aura component which implements="lightning:recordHomeTemplate"
I want to do some server side actions when user click button on template. But I am not able to connect server side controller. Is it something related to lightning:recordHomeTemplate?
Lightning Console does not retain collapse/Expand choice after browser/lightning tab refresh. Is there any way to retain collapse/expand choice after refresh so that user will have consistent behaviour.
I want to refresh custom lightning component when file is attach to record from 'Files' related list.
Please suggest how to achieve the same.
We have migrated to lightning knowledge so we installed new lightniing AQI package. We need to make it as same as classic app that we are using. But with new application we are unable to change the labels. Does anyone knows the fix?
I have a requirement where I need to create new button or quick action to create knowledge article from case record. I used force:createRecord event to do this. But I need created Article record ID so that I can associate Case and Article in CaseArticle Object.
Please suggest how can I achive this. I found some links which asks to use lightning:navigation, but still I am not sure how to get created article record ID after article creation.
_self is opening new subtab in lightning console. I dont want to open link in new subtab. It should override primary subtab. The formula field is-

(" [" &
HYPERLINK("/apex/Sc_UpdateCustomerEnvironment_Update?action=Select&CaseNumid="&Id,"Select", "_self") & "]" &
" [" & HYPERLINK("/apex/Sc_UpdateCustomerEnvironment_Update?action=View&CaseNumid="&Id&"&EnvId="&CustomerEnvironment__c,"View Selected", "_self") & "]" &
" [" & HYPERLINK("/apex/Sc_UpdateCustomerEnvironment_Update?action=Edit&CaseNumid="&Id&"&EnvId="&CustomerEnvironment__c, "Edit Selected", "_self") & "]" &" [" &
HYPERLINK("/apex/Sc_UpdateCustomerEnvironment_Update?action=New&CaseNumid="&Id,"New Environment", "_self") & "]")

It is working perfect in classic console.
We are trying to show '<' and '>' character in feeditem body. But we are getting invalid markup error while inserting the feeditem.body.

String is <test>

public static void createRFAFeedEntry(List<Request_for_Assistance__c> newRFA){
        List<FeedItem> feedItemsList = new List<FeedItem>();
        for(Request_for_Assistance__c req : newRFA) {
            if(req.recordtypeid==JIRA_RECORD_TYPE_ID){
                FeedItem post = new FeedItem();
                FeedItem post_sec = new FeedItem();
                post.ParentId = req.id;
                post.createdById = req.createdbyid;
                String fullFileURL = URL.getSalesforceBaseUrl().toExternalForm()+'/'+ req.id;
                String stringURL  = '<a href='+fullFileURL+' >'+req.Name+'</a>';
                post.LinkUrl = fullFileURL ;
                post.Title = 'Created '+req.Name;
                post.Visibility = 'InternalUsers';
                
                               /**********************/
               
               String summ=String.valueof(req.Summary__c);
               String escapeString = summ.escapeHtml3();
               string escapeString1=escapeString.unescapeHtml3();
               /* String sum1 =String.valueof(req.Summary__c) ;
                String target1 = '<';
                String target2='>';
                String replacement1 = '{';
                String replacement2 = '}';
                String sum2 = sum1.replace(target1, replacement1);
                //system.debug('test string***'+sum2);
                String summary = sum2.replace(target2, replacement2);
                //system.debug('test string***'+summary);
                
                String pdd1 =String.valueof(req.Problem_Description_and_Definition__c);
                String target11 = '<';
                String target21='>';
                String pdd2 = pdd1.replace(target11, replacement1);
                //system.debug('test string***'+pdd2);
                String pdd = pdd2.replace(target21, replacement2);
                //system.debug('test string***'+summary);
                */
               /******************/   
                //post.Body =  'Created Date - '+req.CreatedDate+'\nSummary - '+req.Summary__c +'\nProblem Description and Definition - '+req.Problem_Description_and_Definition__c;
              
              post.Body =  'Created Date - '+req.CreatedDate+'\nSummary - '+ escapeString1 +'\nProblem Description and Definition - '+req.Problem_Description_and_Definition__c;
                
               feedItemsList.add(post);
               // feedItemsList.add(post); 
            }           
        }
        System.debug('feeditemlist--'+feedItemsList);
        if(!feedItemsList.isEmpty())
        insert feedItemsList;
        
    }
Insert failed. First exception on row 0; first error: INVALID_MARKUP, Error while parsing Rich Text Content: Unsupported HTML tag or attribute encountered.

Please help.
We are trying to show '<' and '>' character in feeditem body. But we are getting invalid markup error while inserting the feeditem.body.

String is <test>

public static void createRFAFeedEntry(List<Request_for_Assistance__c> newRFA){
        List<FeedItem> feedItemsList = new List<FeedItem>();
        for(Request_for_Assistance__c req : newRFA) {
            if(req.recordtypeid==JIRA_RECORD_TYPE_ID){
                FeedItem post = new FeedItem();
                FeedItem post_sec = new FeedItem();
                post.ParentId = req.id;
                post.createdById = req.createdbyid;
                String fullFileURL = URL.getSalesforceBaseUrl().toExternalForm()+'/'+ req.id;
                String stringURL  = '<a href='+fullFileURL+' >'+req.Name+'</a>';
                post.LinkUrl = fullFileURL ;
                post.Title = 'Created '+req.Name;
                post.Visibility = 'InternalUsers';
                
                               /**********************/
               
               String summ=String.valueof(req.Summary__c);
               String escapeString = summ.escapeHtml3();
               string escapeString1=escapeString.unescapeHtml3();
               /* String sum1 =String.valueof(req.Summary__c) ;
                String target1 = '<';
                String target2='>';
                String replacement1 = '{';
                String replacement2 = '}';
                String sum2 = sum1.replace(target1, replacement1);
                //system.debug('test string***'+sum2);
                String summary = sum2.replace(target2, replacement2);
                //system.debug('test string***'+summary);
                
                String pdd1 =String.valueof(req.Problem_Description_and_Definition__c);
                String target11 = '<';
                String target21='>';
                String pdd2 = pdd1.replace(target11, replacement1);
                //system.debug('test string***'+pdd2);
                String pdd = pdd2.replace(target21, replacement2);
                //system.debug('test string***'+summary);
                */
               /******************/   
                //post.Body =  'Created Date - '+req.CreatedDate+'\nSummary - '+req.Summary__c +'\nProblem Description and Definition - '+req.Problem_Description_and_Definition__c;
              
              post.Body =  'Created Date - '+req.CreatedDate+'\nSummary - '+ escapeString1 +'\nProblem Description and Definition - '+req.Problem_Description_and_Definition__c;
                
               feedItemsList.add(post);
               // feedItemsList.add(post); 
            }           
        }
        System.debug('feeditemlist--'+feedItemsList);
        if(!feedItemsList.isEmpty())
        insert feedItemsList;
        
    }
Insert failed. First exception on row 0; first error: INVALID_MARKUP, Error while parsing Rich Text Content: Unsupported HTML tag or attribute encountered.

Please help.
Page dont load when you use init handler in aura component which implements="lightning:recordHomeTemplate"
Lightning Console does not retain collapse/Expand choice after browser/lightning tab refresh. Is there any way to retain collapse/expand choice after refresh so that user will have consistent behaviour.
We have migrated to lightning knowledge so we installed new lightniing AQI package. We need to make it as same as classic app that we are using. But with new application we are unable to change the labels. Does anyone knows the fix?
_self is opening new subtab in lightning console. I dont want to open link in new subtab. It should override primary subtab. The formula field is-

(" [" &
HYPERLINK("/apex/Sc_UpdateCustomerEnvironment_Update?action=Select&CaseNumid="&Id,"Select", "_self") & "]" &
" [" & HYPERLINK("/apex/Sc_UpdateCustomerEnvironment_Update?action=View&CaseNumid="&Id&"&EnvId="&CustomerEnvironment__c,"View Selected", "_self") & "]" &
" [" & HYPERLINK("/apex/Sc_UpdateCustomerEnvironment_Update?action=Edit&CaseNumid="&Id&"&EnvId="&CustomerEnvironment__c, "Edit Selected", "_self") & "]" &" [" &
HYPERLINK("/apex/Sc_UpdateCustomerEnvironment_Update?action=New&CaseNumid="&Id,"New Environment", "_self") & "]")

It is working perfect in classic console.
We are trying to show '<' and '>' character in feeditem body. But we are getting invalid markup error while inserting the feeditem.body.

String is <test>

public static void createRFAFeedEntry(List<Request_for_Assistance__c> newRFA){
        List<FeedItem> feedItemsList = new List<FeedItem>();
        for(Request_for_Assistance__c req : newRFA) {
            if(req.recordtypeid==JIRA_RECORD_TYPE_ID){
                FeedItem post = new FeedItem();
                FeedItem post_sec = new FeedItem();
                post.ParentId = req.id;
                post.createdById = req.createdbyid;
                String fullFileURL = URL.getSalesforceBaseUrl().toExternalForm()+'/'+ req.id;
                String stringURL  = '<a href='+fullFileURL+' >'+req.Name+'</a>';
                post.LinkUrl = fullFileURL ;
                post.Title = 'Created '+req.Name;
                post.Visibility = 'InternalUsers';
                
                               /**********************/
               
               String summ=String.valueof(req.Summary__c);
               String escapeString = summ.escapeHtml3();
               string escapeString1=escapeString.unescapeHtml3();
               /* String sum1 =String.valueof(req.Summary__c) ;
                String target1 = '<';
                String target2='>';
                String replacement1 = '{';
                String replacement2 = '}';
                String sum2 = sum1.replace(target1, replacement1);
                //system.debug('test string***'+sum2);
                String summary = sum2.replace(target2, replacement2);
                //system.debug('test string***'+summary);
                
                String pdd1 =String.valueof(req.Problem_Description_and_Definition__c);
                String target11 = '<';
                String target21='>';
                String pdd2 = pdd1.replace(target11, replacement1);
                //system.debug('test string***'+pdd2);
                String pdd = pdd2.replace(target21, replacement2);
                //system.debug('test string***'+summary);
                */
               /******************/   
                //post.Body =  'Created Date - '+req.CreatedDate+'\nSummary - '+req.Summary__c +'\nProblem Description and Definition - '+req.Problem_Description_and_Definition__c;
              
              post.Body =  'Created Date - '+req.CreatedDate+'\nSummary - '+ escapeString1 +'\nProblem Description and Definition - '+req.Problem_Description_and_Definition__c;
                
               feedItemsList.add(post);
               // feedItemsList.add(post); 
            }           
        }
        System.debug('feeditemlist--'+feedItemsList);
        if(!feedItemsList.isEmpty())
        insert feedItemsList;
        
    }
Insert failed. First exception on row 0; first error: INVALID_MARKUP, Error while parsing Rich Text Content: Unsupported HTML tag or attribute encountered.

Please help.
Any functions on the client side controller work without a problem but If i have to make a call to an apex server The function doesnt exists.
Is this a behavior that is not allowed?
 
public with sharing class ContactRecordHomeController {
    
    @AuraEnabled
    public static String updateStatus() {
         User user = [Select sidebar_Status__c From User Where Id = :UserInfo.getUserId()];
         user.sidebar_Status__c = !user.sidebar_Status__c;
         update user;
        return 'user';
    }

}

 
  • September 20, 2018
  • Like
  • 0
Hi,

I'm currently working with the "Discover Built-in XSS Protections in Force.com" Unit of Developer Advanced Trail. The point of the challenge is to edit the comments below each use of "{!sampleMergeField1}" to determine if is vulnerable to XSS. 

Based on the criteria found within the unit and in the guidelines in the Secure Coding Cross Site Scripting page for Built in Auto Encoding (All merge-fields are always auto HTML encoded provided they: do not occur within a <style> or <script> tag, AND do not occur within an apex tag with the escape='false' attribute) I came up with the following answers:
<apex:page controller="Built_In_XSS_Protections_Challenge" sidebar="false" tabStyle="Built_In_XSS_Protections_Challenge__tab">
<apex:sectionHeader title="Built-In XSS Protections Challenge" />
<apex:form >
    <apex:pageBlock >
        <c:Classic_Error />
        <apex:pageMessages />      
        <apex:pageBlockSection title="Demo" columns="1" id="tableBlock">          
            
            <apex:outputText value="{!sampleMergeField1}"/>
            <!-- sampleMergeField1 is vulnerable to XSS: NO -->


            <apex:outputText value="{!sampleMergeField2}" escape="false"/>
            <!-- sampleMergeField2 is vulnerable to XSS: YES -->


            <apex:outputText >
                {!sampleMergeField3}
            </apex:outputText>
            <!-- sampleMergeField3 is vulnerable to XSS: NO -->
       
       
            <style>
                .foo {
                    color: #{!sampleMergeField4};
                }
            </style>
            <!-- sampleMergeField4 is vulnerable to XSS: YES -->
             
            
            {!sampleMergeField5}
            <!-- sampleMergeField5 is vulnerable to XSS: NO -->
            
            
            <script>
                var x = '{!sampleMergeField6}';
            </script>
            <!-- sampleMergeField6 is vulnerable to XSS: YES -->
            
            
            <apex:outputLabel value="{!sampleMergeField7}" escape="false"/>
            <!-- sampleMergeField7 is vulnerable to XSS: YES -->
            
       
        </apex:pageBlockSection>
        <apex:pageBlockSection title="Code links" columns="1">
            <apex:outputPanel >
                <ul>
                    <li><c:codeLink type="Visualforce" namespace="security_thail" name="Built_In_XSS_Protections_Challenge" description="Visualforce Page"/></li>            
                    <li><c:codeLink type="Apex" namespace="security_thail" name="Built_In_XSS_Protections_Challenge" description="Apex Controller"/></li>
                </ul>
            </apex:outputPanel>        
        </apex:pageBlockSection>        
    </apex:pageBlock>          
</apex:form>

But everytime y check the challenge, the same message is displayed:

User-added image

I already checked that I am pointing to the right playground. 

If you can check it and help find where I am going wrong I would be thankful.

Thanks


 

I can't open tab or subtab for Hyperlink in formula field.

formula can do this.

 

HYPERLINK(Id,'Mr. ' &  FirstName & ' ' &  LastName, '_parent') 

 

Thank you so much.

  • July 20, 2011
  • Like
  • 0