• Chandra Sekhar CH N V
  • SMARTIE
  • 1443 Points
  • Member since 2014
  • Consultant
  • Infosys


  • Chatter
    Feed
  • 38
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 7
    Questions
  • 314
    Replies
Hi Team,

I have a requirement i want to clone the case with custom Action. Please provide me the reference component for this. While cloning the case i want to make sure few fiedls are blank with case status as NEW. 

                                      Thanks in advance 

Thanks,
Venkat.
I want to add opportunity names in inline VF page on Lead page layout if the lead owner is same as opportunity owner and he should select one opportunity in the VF page and when he click save button the opportunity name also should get saved.

Is it possible ?
Hello Geeks,

I am stuck and need a help. I have a requirement as follows, Consider a user sends an email with the body and an email subject line as "Subject: Hello 00001043" where 00001043 can be any case number. Now as per my requirement I need two things to be handled.
1. Firstly I need to parse the subject line of the email which user has sent and get the case number from the subject line and match the case number from the subject line with the case number of all the case records in the database. 
    a) If there are any matching case records with the case number from the subject line, then I simply need to attach the email in the email related list of the matched case record.

    b) If no case records are presents with the case number as per the subject line, then only I need to create a new case record with that email sent to be attached to this newly created case record.
    
I have used Email-to-case functionality, where whenever user sends any mail, a new case record gets created automatically irrespecttive of the case number mentioned in the subject line. Say the case with the case number in the subject line if already present in database still it creates new case record and attaches the email to new record. But I want the email to get attached to the old matched record instead of new case to be created.

To handle it I am using InboundEmailHandler code which I am triggering out using Email Service: Execute on Inbound by selecting that apex class but not getting a way out to proceed further. Can anyone help me out in the logic. I am attaching my entire code. Any help would be highly appreciated.

Thanks.

Code:

Global class EmailToCase implements Messaging.InboundEmailHandler
{
    Global Messaging.InboundEmailResult handleInboundEmail(Messaging.InboundEmail email, Messaging.InboundEnvelope env ) 
    {
        //Create an inboundEmailResult object for returning the result of the email service.
        Messaging.InboundEmailResult result = new Messaging.InboundEmailresult();
                 
        //Convert the subject line to ignore the case so the program can match on lower case or upper case.
        String mySubject = email.subject.equalsIgnoreCase();
        
        //String to hold the numbers from the subjectLine
        String caseIdInSubjectLine = '';

        //Check if the numbers are present in the subjectLine
        for(String str : mySubject.split('(?!^)'))
        {
            //Fetch only the numbers from the subjectLine for comparision 
            if(str.isNumeric())
            {
                //Hold the numbers from the subjectLine into a String variable
                caseIdInSubjectLine += str;
            }
        }
        
        //Check if the subject line has a case number
        if(caseIdInSubjectLine != null || caseIdInSubjectLine!= '')
        {
            //List to insert case records to database
            List<Case> lstCaseRecordsToInsert = new List<Case>();
            
            //Fetch all the cases whose case number from the subject line matches with the case records from the database
            List<Case> matchingCases = [Select Id, CaseNumber, Subject, Description From Case Where CaseNumber = :caseIdInSubjectLine];
            
            //Check if there are matched case records
            if(!matchingCases.isEmpty())
            {
                //Simply handled if more than 1 case records with case number are being matched
                if(matchingCases.size() == 1)
                {
                    //Iterate over the matched case records
                    for(Case objMatchedCase : matchingCases)
                    {
                        //Here i want my email to be attached to the matched case
                    }        
                }
                else
                {
                    system.debug(Logginglevel.ERROR, 'EmailToCase.  Create a new case because we found '+matchingCases.size() + ' cases with the subject: "' + mainSubject + '"');
                }
            }
            else
            {
                //Create a new case record 
                Case objCaseToInsert = new Case();
                objCaseToInsert.SuppliedEmail = email.fromAddress;
                objCaseToInsert.SuppliedName = email.fromName;
                objCaseToInsert.Status = 'New';
                objCaseToInsert.Priority = 'Low';                
                objCaseToInsert.Origin = 'Email';
                
                //Subject from the email
                String extractedSubject = email.subject;        
                objCaseToInsert.Subject = extractedSubject;
                objCaseToInsert.Description = email.plainTextBody;
                
                //Add the case records to a list
                lstCaseRecordsToInsert.add(objCaseToInsert);
            }
            
            //If the list contains some values
            if(!lstCaseRecordsToInsert.isEmpty())
            {
                insert lstCaseRecordsToInsert;
            }
        }
        else
        {
            //No case number in the subject line, so do nothing
        }    
    }        
}
I completed this challenge, and everything works correctly, but when I check the challenge, I get the following error...

User-added image

As a check, I went to the next chapter, about sharing reports and dashboards, and that worked correctly.  Any ideas on what may be wrong?
Hi,

 I wrote a trigger on opportunity trigger which will update the custom object which is working fine 
 
trigger Insert_Order_checklist on Opportunity (After Insert, After Update) 
{
/* This trigger is used to insert into order checklist when opportunity stage name = 1 - closed won */

   list<Opportunity> OP = [select id,name from opportunity where id = :Trigger.newMap.keySet() and StageName = '1 - Closed Won' limit 1];
   List<Order_Processing_Checklist__c> OPCi = new list<Order_Processing_Checklist__c>();
   
  // Integer CL = [select count()  from opportunity where id = :Trigger.newMap.keySet() and StageName = '1 - Closed Won'];

  if ( [select count()  from opportunity where id = :Trigger.newMap.keySet() and StageName = '1 - Closed Won'] > 0 ) 
    { 
    if ( [select count()  from Order_Processing_Checklist__c where Opportunity_Name__c = :Trigger.newMap.keySet() ] == 0 ) 
    { 
    
     for ( opportunity opp : op ) 
      {
        
       //list<Order_Processing_Checklist__c> delOP = [select id from Order_Processing_Checklist__c where Opportunity_Name__c = :opp.id ];
       
       //Delete delOp;
        
      Order_Processing_Checklist__c OPC = new Order_Processing_Checklist__c();
        
         OPC.Opportunity_Name__c = opp.id;
         OPC.name = opp.name;
         OPCi.add(OPC);      
        }             
        
      Insert OPCi;
      }
   }


}
I also wrote a test class for above trigger it is not giving code coverage please suggest me what is the mistake in this test class
 
@isTest(SeeAllData = true)
private class Test_Insert_Order_checklist {


public static testmethod void testorderchecklist()
{
  
 test.startTest();
  
 list<Opportunity> OP = [select id,name from opportunity 
                         where
                               StageName = '1 - Closed Won' limit 1];
  
 List<Order_Processing_Checklist__c> OPCi = new list<Order_Processing_Checklist__c>();
  
 for ( opportunity opp : op ) 
 {
       Order_Processing_Checklist__c OPC = new Order_Processing_Checklist__c();
        
         OPC.Opportunity_Name__c = opp.id;
         OPC.name = opp.name;
         OPCi.add(OPC);     
         
        
    
    
    }     
 Insert OPCi;
 
test.stopTest(); 
}


}

Thanks
Sudhir
 
i have test class for vf controller where as soql which is not not covering in code coverage even after inserting one test opp record.Please suggest me that how to get cover this soql.Here oppId is currentpage parameter.
In debug logs opppDeatils list value is coming as 0 but test opp record is inserted in test class.

List<Opportunity> oppDetails =[Select Name
From Opportunity
Where Id =:ApexPages.currentPage().getParameters().get('oppID')];
Hello,

I have created a report of type "Activities with accounts".

I create the report and save it in my personal folders, i see 166 records but when i re save the report in one of the public folders it gives me 50 records.

I dont understand the strange behaviour

Thank you for suggestion !
  • December 21, 2015
  • Like
  • 0

Hi Folks, I have a use case that I need to display total  amount sum from opportunities object in finsh method... please help me ...

global class batchclass1 implements Database.Batchable<Opportunities>{
    
    global batchclass1(){}
        /* Batch class constructor */
    //Start method
    global Database.QueryLocator start(Database.BatchableContext BC)
    {
        String query='SELECT id, Amount from Opportunities';
         return Database.getQueryLocator(query);
        }

    //Excute method
    
global void execute(Database.BatchableContext BC, List<Opportunities> scope)
{
    //Excution logic
    List<Opportunities> opp= new List<Opportunities>
    AggregateResult[] gr= [SELECT SUM(Amount) FROM Opportunities];

    
}
      global void finish(Database.BatchableContext BC){
            // Finish logic
           system.debug('gr');
       }
    
    

}
Hello,

I have a report with "Activities". I have other report with "activities with contacts", they both give same results as the contacts is null for some activities.

I plan to create a new custom report type, for "activities with contacts" which should also give results when contact is null.

Is it possible or No ?
  • December 16, 2015
  • Like
  • 0
Hi,
I am running the test class and getting the debug lines printed in the code also, but somehow the code coverage remains 0%. Any guesses why this is happening.

Thanks,
Yogesh
issue in completing challenge under Data security (Defining Sharing Rules) I have done all things ,like making Organization-Wide Defaults as Private and creating a group for rule Training coordinator and providing readonly access for Project data based on priority. but still getting error as "The sharing rule did not behave as expected. "
Hello Fellow Salesforce Developers!

I have a apex class that are not covered and was hoping to get help in writing the codes for it. I'm at 35% and have been working on this for about a week now and cannot figure it out. Any help that you could provide is greatly appreciated, thank you in advance. :) The lines that I need to cover are as followed:

   public void execute(SchedulableContext ctx) {
       refreshMetrics(null);}

---
     
 HttpRequest req = new HttpRequest();
       String url = INSTANCE + '/services/data/v33.0/actions/standard/metricRefresh';
       req.setEndpoint(url);
       req.setMethod('POST');
       req.setHeader('Authorization', 'OAuth ' + sessionId);
       req.setHeader('Force-Instance-Url', INSTANCE); 
       req.setHeader('Force-User-Id', userId);
       req.setHeader('Accept', 'application/json');
       req.setHeader('Content-Type', 'application/json');
       req.setBody('{"inputs":[{"metricId":"' + metricId + '"}]}'); // metric id
  
       Http http = new Http();
       HTTPResponse res = http.send(req);
       System.debug(res.getBody());
   }
I’m trying to finish up the Visualforce Basics module in Trailhead and keep receiving this error:
Challenge not yet complete... here's what's wrong: 
No Apex class named 'NewCaseListController' was found
 
When I view the setup page in my developer account it shows my Apex class is listed as “ContactsListController” but when I open the class it shows the correct name – “NewCaseListController”.
 
I’ve tried deleting the class and editing the name and nothing is changing the name shown on the setup page.
 
Could this be causing the error message above in Trailhead?
Any suggestions on how to fix it?
(see screenshot and code below)

Controller code:
public class NewCaseListController {
List<Case> results = new List<Case>();


private String sortOrder = 'CaseNumber';
public List<Case> getNewCases() {
    results = [SELECT Id, CaseNumber FROM Case WHERE status = 'new'];

    return results;
    }
}

Page code:
<apex:page controller="NewCaseListController">
    <apex:form >
        <apex:pageBlock title="Case List" id="Case_list">
            <!-- Case_list -->
         <apex:repeat value="{!newCases}" var="case">
         <table style="width:1000px;">
              <tr>
                  <br/>
                  <apex:outputLink value="/{!case.Id}" style="width:160px">{!case.Id}</apex:outputLink>
                  <br/>
               </tr>
           </table>
        </apex:repeat>     
        </apex:pageBlock>
    </apex:form>
</apex:page>



User-added image
 
hi dudes, this is simple aggregate program and here i am sending the aggregate results (values) to the wrapper class, here i am getting error.  please some one help, thanks in advance.

This is the error showing in developer console.
Method does not exist or incorrect signature: [aggregateExample].get(String)              at line 11.

 
public class aggregateExample {
    public list<AggregateResult> result{set;get;}
    public list<ReportExample> reports{set;get;}
    public aggregateExample()
    {
        result=[select StageName,avg(amount)amt from opportunity group by StageName];
        reports=new list<ReportExample>();
        for(aggregateExample rs:result)
        {
            ReportExample re=new ReportExample();
            re.Stagen=(string)rs.get('stagename');
            re.amount=(decimal)rs.get('amt');
            reports.add(re);
            
        }
    }
    public class ReportExample
    {
        public string Stagen{set;get;}
        public decimal amount{set;get;}
    }
}

 
Hello,

When i create join report, I always have the top header of the report type.
Is there way to modify it.

 
  • September 25, 2015
  • Like
  • 0
Hello,

When i create report for opportunities,
There is a option call show "my team's opportunity".

Does this include the people i am manager of , or is it related to role heirarchy.

Thanks
  • September 22, 2015
  • Like
  • 0
Hi Team,

We have one custom object from the managed package. we want to create the replica of the same object with attachmnets records. In this process, we have created custom object and inserted all the records from old custom object.

Now we want to transfer the attachment records associated with the old custom object to another custom object.

Please sugguest any procedure we need to follow or do we have any custom code to accomplish this.

Thanks in Advance,
Anil
Has anyone encountered this error while completing the 3rd step of Build an Automated Workshop Management System badge.................."Campaign members are not being added correctly to the Campaign from the Chapter account. For example, if the Chapter account has 3 contacts, when the Campaign is created, those 3 contacts should be added as Campaign members."
Are there any ways to move attachment files (under Notes & Attachments related list) from  a chiled object to parent object? like  through eclipse/dataloader API etc...? Any suggestions?

I did go through this post is still in ideas and yet to be implemented (https://success.salesforce.com/ideaview?id=08730000000BrAVAA0)
I have a list of select options which I am displaying in a VF page as a multi picklist field. 
 
public List<SelectOption> getEPGName () {
        List<SelectOption> options = new List<SelectOption>();
        for (<sobject> EPG : <my query>]){
            options.add(new SelectOption(EPG.ID, EPG.<my field>));
        }
        SelectOptionSorter.doSort(options, SelectOptionSorter.FieldToSort.Label);
        return options;
}

How can I make it as a Set<string> so that the values will not be duplicated?
I have a query where I am querying a picklist field to gte specific set of values -
 
WHERE <picklist field> like '%value%'

I have now changed the data type to multi select and query gets failed. 

How to replace the original query so that I can get only s specific set of values from the multi select picklist.
I have a set of reports, I want to check if a field is used in grouping/chart in those reports. 

It can't be checked manually as the number of reports is in hundreds.

 
Can we add custom button on user detail page? We do have cusotm links but User object does not allow must customization.

Any workarounds for this?
Need a validation rule on user object to check if a field is not null but can be empty for two specific user records. Tried the below :
 
​IF
(
ISBLANK( WWID__c ),OR(($User.Id <> '<some user ID>'),($User.Id <> '<some user ID>'))
,false)
@isTest
private class NumberOfEmailsSchedulableTest {
    
    public static final Integer numberOfAcc = 5;
    public static final Integer numberOfCon = 2;


    static testmethod void schedulerTest() 
       {
               CreateTestAccountsContactsAndTasks(numberOfAcc, numberOfCon);
               
               List<Task> tasks = [SELECT id, subject, ActivityDate, Sequence_Name__c FROM Task];



           String CRON_EXP = '0 0 0 15 3 ? *';
           
           // Create your test data
           Account acc = new Account();
           acc.name= 'test';
           insert
            acc;
           
           Test.startTest();

               String jobId = System.schedule('ScheduleApexClassTest',  CRON_EXP, new NumberOfEmailsSchedulable());
               CronTrigger ct = [SELECT Id, CronExpression, TimesTriggered, NextFireTime FROM CronTrigger WHERE id = :jobId];
               System.assertEquals(CRON_EXP, ct.CronExpression);
               System.assertEquals(0, ct.TimesTriggered);

           Test.stopTest();
           // Add assert here to validate result
       }


       public static void CreateTestAccountsContactsAndTasks(Integer numOfAccounts, Integer contactsPerAccount)
        {

            Database.DMLOptions dml = new Database.DMLOptions(); 
            dml.DuplicateRuleHeader.allowSave = true;

          List<Account> accounts = new List<Account>();

          for(Integer i = 0; i < numOfAccounts; i++)
            {
            // create new account
                  Account newAccount = new Account(
                      Name         = 'Test' + String.valueOf(i),
                      Industry       = 'Accounting',
                      of_Locations__c = 5 + i,
                    sdr_owner__c = userinfo.getuserid()
                  );

                accounts.add(newAccount);
          }

          Database.insert(accounts, dml);

            List<Contact> contacts = new List<Contact>();

          for(Account act: accounts){
              for(Integer i = 0; i < contactsPerAccount; i++)
              {
                // create new contact
                 Contact con = new Contact(
                    LastName   = 'Test',
                    AccountId   = act.id,
                    Outreach_Status__c = 'In Contact',
                    Title     = 'Test' + String.valueOf(i),
                    Email     = 'test@test.com'
                  );

                  contacts.add(con);
              }
          }

           Database.insert(contacts, dml);

           List<Task> tasksToInsert = new List<Task>();

           for(Contact con : contacts)
           {
                   Task regularTask = new Task(
                       whoid = con.Id,
                       ActivityDate = Date.today(),
                       Status = 'Completed'
                   );
                   Task personalizedTask = new Task(
                       Sequence_Name__c = 'personalized',
                       whoid = con.Id,
                       ActivityDate = Date.today(),
                       Status = 'Completed'
                   );
                   Task sequencedTask = new Task(
                       Sequence_Name__c = 'WYWYN19',
                       whoid = con.Id,
                       ActivityDate = Date.today(),
                       Status = 'Completed'

                   );


                   tasksToInsert.add(regularTask);
                   tasksToInsert.add(personalizedTask);
                   tasksToInsert.add(sequencedTask);
           }

           Database.insert(tasksToInsert, dml);
        }

        public static User createUser(String username , String theAlias)
        {
          Integer randomInt = Integer.valueOf(math.rint(math.random()*1000));
            User u = new User
            (
               Alias = theAlias + String.valueOf(randomInt),
              Email = username + String.valueOf(randomInt)+ '@test.com',
            FirstName = 'Joe',
            LastName = username + String.valueOf(randomInt),
            TimeZoneSidKey = 'America/Los_Angeles',
            UserName = username + String.valueOf(randomInt) + '@test.com',
            LocaleSidKey = 'en_US',
            EmailEncodingKey = 'UTF-8',
            LanguageLocaleKey = 'en_US',
            ProfileID = UserInfo.getProfileId()
            );

            insert u;
            return u;
        }
    
}

I user database.Insert and no tasks appear. Why?
Hi Team,

I have a requirement i want to clone the case with custom Action. Please provide me the reference component for this. While cloning the case i want to make sure few fiedls are blank with case status as NEW. 

                                      Thanks in advance 

Thanks,
Venkat.
Hi,

I have a Lightning:RecordEditForm that creates a record after the form has been submitted. Once the form has been saved, I require the values on the form to be set back to null, as multiple responses are reuqired without the page refreshing.

I have currently tried giving the lightning:inputField an aura id the setting that value to null within the onSuccess method but the value remains.

I have also tried e.force:refreshView but again the submitted value is present.

Component:
<lightning:recordEditForm aura:id="incidentForm" onsubmit="{!c.onRecordSubmit}" onsuccess="{!c.afterSubmit}" onload="{!c.onLoad}" objectApiName="Case" recordTypeId="0120c000001FwVPAA0">

    <lightning:inputField fieldName="Subject" aura:id="input_Subject" />
    
    <div class="slds-m-top_medium">
        <lightning:button disabled="{!v.disabled}" variant="brand" type="submit" name="save" label="Add" />
    </div>
</lightning:recordEditForm>

Controller:
//Submit Incident
    onRecordSubmit: function(component, event, helper) {        
        event.preventDefault(); // stop form submission
        
        var eventFields = event.getParam("fields");
        component.find('incidentForm').submit(eventFields);
        helper.fireRefreshEvt(component); 
    },

//On Success - After Incident Added 
    afterSubmit : function (component, event, helper) {
        component.find("input_Subject").set("v.value", "");      
        helper.getIncidents(component);
    },

Helper:
fireRefreshEvt : function(component) {
        var refreshEvent = $A.get("e.force:refreshView");
        if(refreshEvent){
            refreshEvent.fire();
        }
    }


 
I have a client who wants to enter information into a Text (?) field on a Salesforce record.  Different users could update this field at various times, but when the user hits the Save button on the record, the information gets saved in that field, and the user name, and date/time should be stamped on the entry, as well.
Ideally, the most recent entry will always go to the top.  Thus, the next user entering information will see who made the last entry, when it was done, and determine what next steps might be.
Can I create a trigger to make that happen? 
  • February 07, 2019
  • Like
  • 0
Hi,
We are looking to build a visualforce page to display if there any cusomers waiting in the LiveAgent queue. We started by looking for a controller but cant seem to find anything where this data would be available. If anyone has any ideas where we would start on what we would need to use to pull the data onto the page would be greatly appreciated.

We are very new to salesforce but have a huge appetite to succeed with it.

Many thanks
Matthew
Hi,

We have a custom object called Subscription Line. This object has the Email tab, but the To: field for email is not automatically populated with the related account's email. Anyone knows how to do this? The account is not directly linked to the Subscription Line, but to the Subscription.User-added image
Hi, 

I am trying to access visual force page through base url as below. But I am receiving an error message saying "Your account has been disabled
Your company administrator has disabled access to the system for you. Please contact your administrator for more information "

But when go to Visual force page and click on Preview its working. Any  thoughts why its happenning so. 
  • July 04, 2018
  • Like
  • 0
Hi,
We have a process uploading image through VF which inclued cropping image as well, but some photos after uploaded they are rotated to horizontal and we don't have an option to rotate back. Is there a way to auto rotate to potrait? or is there a way to rotate ? please see the code below?
<apex:page controller="ImageCropper" id="pg" showHeader="false" sidebar="false" >
   <head>
      <meta http-equiv='cache-control' content='no-cache'/>
      <meta http-equiv='expires' content='0'/>
      <meta http-equiv='pragma' content='no-cache'/>      
   </head>
    
  <body>
      <style>
           .btn_active{
                height: 25px;
                padding: 0px 15px !important;
                border: 1px solid #CCC !important;
                color: #015BA7;
                font-weight: bold !important;
                font-family: arial !important;
                font-size: 12px;
                position: relative !important;
                left: 0px !important;
                cursor: pointer !important;
                border-radius: 2px !important;
                line-height: 26px !important;
                text-decoration: none !important;
                display: inline-block;
            }
      </style>
      <!--<apex:inputHidden id="DocId" value="{!DocID}"/>-->
              
      <apex:outputPanel rendered="{!NOT(doneuploading)}">
          
         <apex:form id="frm1">
             
            <apex:actionFunction name="EditProfilePicture" id="editpic" action="{!uploadPicture}">
               <apex:param value="false" name="uploadDoc" assignTo="{!uploadCroping}"/>
            </apex:actionFunction>
            <!--Start ChangeProfile_picture-->
            <div class="ChangeProfile_picture"  style="display: block; margin: 0 auto;width: 250px;">
               <center>
                  <div style="font-size: x-large;">Upload Your Photo </div>
                  
               </center>
               <!--Start formbox-->
               <div class="formbox" style="width:100% !important; margin-left:-20% !important">
                  <form>
                     <table class="table" border="0" cellpadding="5" cellspacing="0">
                        
                        <tr>
                           <td>
                              <center>
                              <label>
                                 <apex:inputFile style="padding: 4.5px 10px;width: 95.5%;" id="fileid" fileSize="{!fsize}" accept="image/jpeg" size="40" title="Browse"  value="{!propFileBody}" fileName="{!propFileName}"  contentType="{!propContentType}" ></apex:inputFile>
                              </label>                              
                              <div class="paginationstyle" style="display:inline"><a href="javascript: void(0);" class="btn_active" onclick="validateProfilePicture(); return false;" title="Submit">Crop your photo</a>
                              </div>  
                              <br/>
                             <div id="ErrorDiv" style="color: red;"> </div>
                              <apex:messages style="color: red; font-size: 10px; background-color:#ffffe0;font-weight:bold !important;"/>
                              </center>                            
                           </td>
                        </tr>
                     </table>
                  </form>
               </div>
               <!--End formbox-->    
            </div>
         </apex:form>
      </apex:outputPanel>
      <apex:outputPanel rendered="{!doneuploading}">
         <style>
            .imageBox {
                position: relative;
                height: 580px;
                width: 600px;
                border:1px solid #aaa;
                background: #fff;
                overflow: hidden;
                background-repeat: no-repeat;
                cursor:move;
            }
            .imageBox .thumbBox {
                position: absolute;
                top: 25%;
                left: 45%;
                width: 294px;
                height: 376px;
                margin-top: -50px;
                margin-left: -125px;
                box-sizing: border-box;
                border: 1px solid rgb(102, 102, 102);
                box-shadow: 0 0 0 1000px rgba(0, 0, 0, 0.5);
                background: none repeat scroll 0% 0% transparent;
            }
            .imageBox .spinner {
                position: absolute;
                top: 0;
                left: 0;
                bottom: 0;
                right: 0;
                text-align: center;
                line-height: 400px;
                background: rgba(0,0,0,0.7);
            }
            .container {
                position: relative;
                top: 10%;
                margin: 0 auto;
                width: 600px;
            }
            .action {
                width: 600px;
                height: 30px;
                margin: 10px 0;
            }
            .cropped>img {
                margin-right: 10px;
            }           
         </style>
         <apex:form id="frm2">
            <apex:actionFunction name="UploadCropPicture" id="croppic" action="{!uploadPicture}" reRender="outputcrop" oncomplete="oncompCropping();">
               <apex:param value="" name="dataurl" assignTo="{!inputdataUrl}"/>
               <apex:param value="true" name="uploadcroping" assignTo="{!uploadCroping}"/>
            </apex:actionFunction>
            <div class="container">
               <div class="imageBox">
                  <div class="thumbBox"></div>
                  <div class="spinner" style="display: none">Loading...</div>
               </div>
               <div class="action">
                  <a href="javascript:void(0);" id="btnCrop" class="btn_active" style="float: right;text-align:center;background-color: #011E41;color:white;">Crop</a>
                  <a href="javascript:void(0);" id="btnZoomIn" class="btn_active" style="float: right;text-align:center;background-color: #011E41;color:white;">Zoom IN</a>
                  <a href="javascript:void(0);" id="btnZoomOut" class="btn_active" style="float: right;text-align:center;background-color: #011E41;color:white;">Zoom Out</a>
               </div>
               <div class="cropped">
               </div>
            </div>
         </apex:form>
      </apex:outputPanel>
   </body>
   <apex:outputPanel id="outputcrop">
      <script type="text/javascript">
         'use strict';
         var cropbox = function(options){
             var el = document.querySelector(options.imageBox),
             obj = {
                 state : {},
                 ratio : 1,
                 options : options,
                 imageBox : el,
                 thumbBox : el.querySelector(options.thumbBox),
                 spinner : el.querySelector(options.spinner),
                 image : new Image(),
                 getDataURL: function () {
                     var width = this.thumbBox.clientWidth,
                         height = this.thumbBox.clientHeight,
                         canvas = document.createElement("canvas"),
                         dim = el.style.backgroundPosition.split(' '),
                         size = el.style.backgroundSize.split(' '),
                         dx = parseInt(dim[0]) - el.clientWidth/2 + width/2,
                         dy = parseInt(dim[1]) - el.clientHeight/2 + height/2,
                         dw = parseInt(size[0]),
                         dh = parseInt(size[1]),
                         sh = parseInt(this.image.height),
                         sw = parseInt(this.image.width);
         
                     canvas.width = width;
                     canvas.height = height;
                     var context = canvas.getContext("2d");
                     context.drawImage(this.image, 0, 0, sw, sh, dx, dy, dw, dh);
                     var imageData = canvas.toDataURL('image/jpeg');
                     return imageData;
                 },
                 getBlob: function() {
                     var imageData = this.getDataURL();
                     var b64 = imageData.replace('data:image/jpeg;base64,','');
                     var binary = atob(b64);
                     var array = [];
                     for (var i = 0; i < binary.length; i++) {
                         array.push(binary.charCodeAt(i));
                     }
                     return new Blob([new Uint8Array(array)], {type: 'image/jpeg'});
                 },
                 zoomIn: function () {
                     this.ratio*=1.1;
                     setBackground();
                 },
                 zoomOut: function () {
                     this.ratio*=0.9;
                     setBackground();
                 }
             },
             attachEvent = function(node, event, cb) {
                 if (node.attachEvent)
                     node.attachEvent('on'+event, cb);
                 else if (node.addEventListener)
                     node.addEventListener(event, cb);
             },
             detachEvent = function(node, event, cb) {
                 if(node.detachEvent) {
                     node.detachEvent('on'+event, cb);
                 }
                 else if(node.removeEventListener) {
                     node.removeEventListener(event, render);
                 }
             },
             stopEvent = function (e) {
                 if(window.event) e.cancelBubble = true;
                 else e.stopImmediatePropagation();
             },
             setBackground = function() {
                var elemArray = document.getElementsByClassName("imageBox")[0].style.backgroundPosition;
                if(elemArray.length == 0) {
                 var w =  parseInt(obj.image.width)*obj.ratio;
                 var h =  parseInt(obj.image.height)*obj.ratio;
                 var pw = (el.clientWidth - w) / 2;
                 var ph = (el.clientHeight - h) / 2;
                 el.setAttribute('style',
                         'background-image: url(' + obj.image.src + '); ' +
                         'background-size: ' + w +'px ' + h + 'px; ' +
                         'background-position: ' + pw + 'px ' + ph + 'px; ' +
                         'background-repeat: no-repeat');
                }
                if(elemArray.length>0) {
                 var w =  parseInt(obj.image.width)*obj.ratio;
                 var h =  parseInt(obj.image.height)*obj.ratio;
                 var pw = (el.clientWidth - w) / 2;
                 var ph = (el.clientHeight - h) / 2;
                
                 el.setAttribute('style',
                         'background-image: url(' + obj.image.src + '); ' +
                         'background-size: ' + w +'px ' + h + 'px; ' +
                         'background-position: '+elemArray+'; ' +
                         'background-repeat: no-repeat');
                }
             },
             imgMouseDown = function(e) {
                 stopEvent(e);
                 obj.state.dragable = true;
                 obj.state.mouseX = e.clientX;
                 obj.state.mouseY = e.clientY;
             },
             imgMouseMove = function(e) {
                 stopEvent(e);
                 if (obj.state.dragable) {
                     var x = e.clientX - obj.state.mouseX;
                     var y = e.clientY - obj.state.mouseY;
         
                     var bg = el.style.backgroundPosition.split(' ');
         
                     var bgX = x + parseInt(bg[0]);
                     var bgY = y + parseInt(bg[1]);
         
                     el.style.backgroundPosition = bgX +'px ' + bgY + 'px';
         
                     obj.state.mouseX = e.clientX;
                     obj.state.mouseY = e.clientY;
                 }
             },
             imgMouseUp = function(e) {
                 stopEvent(e);
                 obj.state.dragable = false;
             },
             zoomImage = function(e) {
                 var evt=window.event || e;
                 var delta=evt.detail? evt.detail*(-120) : evt.wheelDelta;
                 delta > -120 ? obj.ratio*=1.1 : obj.ratio*=0.9;
                 setBackground();
             }
         
             obj.spinner.style.display = 'block';
             obj.image.onload = function() {
                 obj.spinner.style.display = 'none';
                 setBackground();
         
                 attachEvent(el, 'mousedown', imgMouseDown);
                 attachEvent(el, 'mousemove', imgMouseMove);
                 attachEvent(document.body, 'mouseup', imgMouseUp);
                 var mousewheel = (/Firefox/i.test(navigator.userAgent))? 'DOMMouseScroll' : 'mousewheel';
                 attachEvent(el, mousewheel, zoomImage);
             };
             obj.image.src = options.imgSrc;
             attachEvent(el, 'DOMNodeRemoved', function(){detachEvent(document.body, 'DOMNodeRemoved', imgMouseUp)});
         
             return obj;
         };
      </script>
      <script type="text/javascript">
         var imageData;
         
         function validateProfilePicture(){
             var inpt_file = document.getElementById('pg:frm1:fileid');
             if(inpt_file.value == '' || inpt_file.fileName == '' || inpt_file.contentType == ''){             
                 document.getElementById('ErrorDiv').innerHTML = '<b>Error:</b> Please specify a file to upload, or use the "Browse" button to locate it in your local file system.';
             }
             else{
             document.getElementById('ErrorDiv').innerHTML = '';
             window.resizeTo(750, 700);
             EditProfilePicture(false);
             }
         }
         
         function loadcropper() {
             var options =
             {
                 imageBox: '.imageBox',
                 thumbBox: '.thumbBox',
                 spinner: '.spinner',
                 imgSrc: '{!upldocUrl}'
             }
             var cropper = new cropbox(options);
             document.querySelector('#btnCrop').addEventListener('click', function(){
                 imageData = cropper.getDataURL();

                 var r = window.confirm("Are you sure you want to upload this profile picture?");
                 if (r == true) {
                     UploadCropPicture(imageData,true);
                 } else {}                
             });
             document.querySelector('#btnZoomIn').addEventListener('click', function(){
                 cropper.zoomIn();
             });
             
             document.querySelector('#btnZoomOut').addEventListener('click', function(){
                 cropper.zoomOut();
             });
         }
         
         function onclickData()
         {
             imageData = $('.image-editor').cropit('export');
         }
         function loadImagesection(){        
             var doneuploading = {!doneuploading};
             if(doneuploading)
             {
                 loadcropper();          
             }
         }
         
         function oncompCropping() {
             var doneuploadingtemp = {!doneuploadingCroping};
             if(doneuploadingtemp) {
                 var DocId = "{!DocID}"; 
                 window.opener.updateURL(DocId);
             }
         }
         loadImagesection();
      </script>
   </apex:outputPanel>
</apex:page>

 
when the user click approve the Approval, this error message come out(someone else may have acted on the request, or we ran into some trouble) . This error is happenening only in mobile/tab9android) browser in System it is working fine.

Want to ask, why will this error message appear?
 
Is there a place to customize this? (i have been searching around, thought i may have miss out)

Thanks in advance
 
 
My apex class : 



public class fatchAccountRecords{
    public static String fetchAccounts(){
        string strSessionid = loginsalesforce.login();
        
        HttpRequest req = new HttpRequest();        
        //String strEndpointURL = 'https://na15.salesforce.com/services/apexrest/BoxRecords';
        String strEndpointURL = 'https://111-dev-ed.my.salesforce.com/services/apexrest/Account';
        req.setEndpoint(strEndpointURL);
        req.setMethod('GET');  
       
         Account acc=[select id,name,phone,website from account where id='0019000001nz3Zq'];
       
        String naame=acc.name;
        req.setBody('<?xml version="1.0" encoding="UTF-8"?><request><name>'+ naame +'</name></request>');
  
     system.debug('ssssssssssssssssssss'+req.getbody());
   
        //req.setBody(''); 
        req.setTimeout(60000);
        req.setHeader('Authorization','Bearer '+strSessionid );
        req.setHeader('Content-Type', 'application/json; charset=UTF-8');        

        HttpResponse res =  new Http().send(req);
        system.debug('response'+ res);
        system.debug('response'+ res.getBody());
        return res.getBody();
    }    
}


On destination org APEX class: 

@RestResource(urlMapping='/Account/*')
global with sharing class MyRestResource {
  
  @HttpPost
    global static String doPost(String name) {
        Account account = new Account();
        account.Name = name;
       // account.phone = phone;
       // account.website = website;
        insert account;
        return account.Id;
    }
}

It is giving the15:46:12:444 USER_DEBUG [25]|DEBUG|response[{"message":"Unexpected character ('<' (code 60)): expected a valid value (number, String, array, object, 'true', 'false' or 'null') at [line:1, column:2]","errorCode":"JSON_PARSER_ERROR"}] 

Thanks in advance
 
my requirement is this:
first i need to create two record types for a standard object lets suppose for account
then using custom setting i linked the record type and visual force page 
then using the apex code i have to display the correct visual force page according to the record type.
can anyone suggest the code for this
My task is to migrate knowledge articles from pre-prod sandbox to production. The knowledge articles predominantly FAQ are created in the pre-prod sandbox and are to be migrated to production. What is the best way to do this?