• Sangeeth R 5
  • 5 Points
  • Member since 2017

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
  • 5
The Object 'Product__c'  is in master detail relation with the object 'Order_Product__c' .the object 'Order_Product__c' consists of a custom field 'Quantity' ,the average should be calculated for the 'Quantity' fields of all the records, that average should be updated in another Object 'Product_maintanance__c's' field which is the parent of Object 'Order_Product__c'.  the average should be updated separately based on the Object 'Product__c' ID .The Object 'Product__c' is the Parent of Object 'Product_maintanance__c'.

When I try this method, The field get's updated in Object 'Product_maintanance__c' but not based on the Object 'Product__C' Id. it updates the same Quantity value to all the fields in Object 'Product_maintanance__c'.

 global class BatchapextoUpdateQuantity implements Database.Batchable<SObject>,Schedulable {
        global Decimal avg;
        global Database.querylocator start(Database.Batchablecontext bc){
           string  query='select id from Product_maintanance__c';
            return database.getQueryLocator(query);
        global void execute(Database.BatchableContext BC, list<sObject>prolst){
           productMaintananceHelper pmh=new ProductMaintananceHelper();
      AggregateResult[] result= [select ProductESB__c,avg(Quantity__c)aver from Order_Product__c  group by productESB__c];
              for( AggregateResult ar : result){
            list<Product_maintanance__c> pmlst=new list<Product_maintanance__c>();
                list<Product_maintanance__c> prodlist=[select id from Product_maintanance__c];
            for(Product_maintanance__c pm : prodlist){
                    update pmlst;
                catch(Exception e){
                    System.debug('Exception is '+e.getMessage());
        global void finish(Database.Batchablecontext bc){
        global void execute(SchedulableContext sc) {
            BatchapextoUpdateQuantity ba=new BatchapextoUpdateQuantity();
             //string sch = '0 00 00 * * ?';
         //system.schedule ('Batch', sch, new BatchapextoUpdateQuantity());
I have identified the following vectors, but I am still blocked from completing the challenge. What am I missing?
<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}"/>
            <!-- Line 9 is vulnerable to XSS: NO -->

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

            <apex:outputText >
            <!-- Line 18 is vulnerable to XSS: YES / NO -->
                .foo {
                    color: #{!sampleMergeField4};
            <!-- Line 25 is vulnerable to XSS: YES -->
            <!-- Line 31 is vulnerable to XSS: NO -->
                var x = '{!sampleMergeField6}';
            <!-- Line 36 is vulnerable to XSS: YES -->
            <apex:outputLabel value="{!sampleMergeField7}" escape="false"/>
            <!-- Line 41 is vulnerable to XSS: YES -->
        <apex:pageBlockSection title="Code links" columns="1">
            <apex:outputPanel >
                    <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>