• Oxala Alexandre
  • NEWBIE
  • 10 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 3
    Replies
Hello
I have developped a VF page with a controller extension on case
When I perform my action, I want to go back to my case
Here is my code : caseId is defined and is Id of case and is defined in function processResult
But in mobile, I don't go back to case detail and in browser I have got this error : Uncaught ReferenceError: Desktop is not defined
Can you please help ?


function saveSignature()
{
    strDataURI = "blabla";
    AnyObjectSignatureController.saveSignature(strDataURI,caseId,processResult);
}

function processResult(result)
{
    myresult=JSON.stringify(result);
    if (myresult=="\"OK\"")
    {
         myUrl="https://cs17.salesforce.com/"+caseId;
         if( (typeof sforce != 'undefined') && (sforce != null) ) {
              // Salesforce1 navigation
              sforce.one.navigateToSObject(caseId);
            }
         else {
            // when calling action from browser
             window.close();
         }
        
    }
    else
    {
        alert("Erreur à la sauvegarde : "+myresult);
    }
}
I want to ensure that a page layout is only useful for Salesforce1 or mobile browser app only. It looks like I can only assign by profile, as opposed to also when same use is using mobile device.

How do I not only assign a page layout to a profile but also say to use this only for mobile devices?

  • April 30, 2014
  • Like
  • 0

Hi All,

 

Anyone able to help me fill a gap.

 

I have the below VF page and Apex code that allow me to filter current information within a custom object.

 

What I need and I can't find an example of how to do this is the ability to press my clone button and have it clone any records that I have checked.

 

At the moment the below will display a list that match the criteria as well as provide 3 additional columns - one for year & term and checkbox for you to select. Once you have done this I would like to be able to press the clone button then all the records checked will be cloned and the year and term updated based on what I've selected.

 

VF Page:

<apex:page controller="DESCloningController">
 <apex:form > 
  <apex:pageBlock >
  <apex:pageBlockSection >
          <apex:inputField value="{!SearchCriteria.Sheet_Type__c}"/>   
          <apex:inputField value="{!SearchCriteria.Year__c}"/>
          <apex:inputField value="{!SearchCriteria.Term__c}"/>
          <apex:commandButton value="Search" action="{!Des}" reRender="applicantTbl,error"/>
          <apex:commandButton value="Clone" action="{!cloneDes}" />
  </apex:pageBlockSection>
  <apex:pageBlockSection id="applicantTbl"  >
            <apex:pageBlockTable value="{!DESs}" var="des" columns="7">
                <apex:column headerValue="Clone">
                    <apex:inputCheckbox value="{!clone}"/>
                </apex:column>
                <apex:column headerValue="Year"> 
                    <apex:selectList size="1" value="{!termoptions}" >
                        <apex:selectOptions value="{!items1}"/>
                    </apex:selectList>
                </apex:column>
                <apex:column headerValue="Term"> 
                    <apex:selectList size="1" value="{!yearoptions}" >
                        <apex:selectOptions value="{!items}"/>
                    </apex:selectList>
                </apex:column>
                <apex:column value="{!des.District__c}" headerValue="District"></apex:column>
                <apex:column value="{!des.Year__c}" headerValue="Year"></apex:column>
                <apex:column value="{!des.Term__c}" headerValue="Term"></apex:column>
                <apex:column value="{!des.Sheet_Type__c}" headerValue="Sheet Type"></apex:column>
            </apex:pageBlockTable>
        </apex:pageBlockSection>
      <apex:pageMessages id="error"></apex:pageMessages>
  </apex:pageBlock>
  
    </apex:form>
</apex:page>

 Apex Class

 

public with sharing class DESCloningController {

    public PageReference cloneDes() {
        return null;
    }

    public String termoptions { get; set; }
    public String clone { get; set; }
    public String yearoptions { get; set;}
    public List<District_Entitlement_Sheet__c> DESs{get;set;}
    public String SelectedValue1{get;set;}
    public String SelectedValue2{get;set;}
    public String SelectedValue3{get;set;}
    public District_Entitlement_Sheet__c SearchCriteria{get;set;}
    
    public DESCloningController ()
    {
        SearchCriteria = new District_Entitlement_Sheet__c();
    }
    public List<SelectOption> getItems() {
                List<SelectOption> yearoptions = new List<SelectOption>();
                    yearoptions.add(new SelectOption('2013','2013'));
                    yearoptions.add(new SelectOption('2014','2014'));
                    yearoptions.add(new SelectOption('2015','2015'));
        return yearoptions;
    }
    public List<SelectOption> getItems1() {
                List<SelectOption> termoptions = new List<SelectOption>();
                    termoptions.add(new SelectOption('Term 1','Term 1'));
                    termoptions.add(new SelectOption('Term 2','Term 2'));
                    termoptions.add(new SelectOption('Term 3','Term 3'));
        return termoptions;
    } 
    public void DES()    
    {
        DESs = new List<District_Entitlement_Sheet__c>();
        DESs = [SELECT Id,
                                     Country__c,
                                     District__c,
                                     Year__c,
                                     Term__c,
                                     Sheet_Type__c,
                                     Form_1_Bata_shoes__c,
                                     Form_1_Bed_Sheets__c,
                                     Form_1_Blanket__c,
                                     Form_1_Blouse__c,
                                     Form_1_Calculator__c,
                                     Form_1_Counter_Books__c,
                                     Form_1_Dress__c,
                                     Form_1_Exercise_Books__c,
                                     Form_1_Hardcover_books__c,
                                     Form_1_Maths_set__c,
                                     Form_1_Pens__c,
                                     Form_1_Pocket_money__c,
                                     Form_1_Safe_Term_Time_Accommodation__c,
                                     Form_1_Sanitary_Wear__c,
                                     Form_1_School_Bag__c,
                                     Form_1_Shoes__c,
                                     Form_1_Skirt__c,
                                     Form_1_Soap__c,
                                     Form_1_Socks__c,
                                     Form_1_Sugar__c,
                                     Form_1_Sweater__c,
                                     Form_1_Washing_powder__c,
                                     Form_2_Bata_shoes__c,
                                     Form_2_Bed_Sheets__c,
                                     Form_2_Blanket__c,
                                     Form_2_Blouse__c,
                                     Form_2_Calculator__c,
                                     Form_2_Counter_Books__c,
                                     Form_2_Dress__c,
                                     Form_2_Exercise_Books__c,
                                     Form_2_Hardcover_books__c,
                                     Form_2_Maths_set__c,
                                     Form_2_Pens__c,
                                     Form_2_Pocket_money__c,
                                     Form_2_Safe_Term_Time_Accommodation__c,
                                     Form_2_Sanitary_Wear__c,
                                     Form_2_School_Bag__c,
                                     Form_2_Shoes__c,
                                     Form_2_Skirt__c,
                                     Form_2_Soap__c,
                                     Form_2_Socks__c,
                                     Form_2_Sugar__c,
                                     Form_2_Sweater__c,
                                     Form_2_Washing_powder__c,
                                     Form_3_Bata_shoes__c,
                                     Form_3_Bed_Sheets__c,
                                     Form_3_Blanket__c,
                                     Form_3_Blouse__c,
                                     Form_3_Calculator__c,
                                     Form_3_Counter_Books__c,
                                     Form_3_Dress__c,
                                     Form_3_Exercise_Books__c,
                                     Form_3_Hardcover_books__c,
                                     Form_3_Maths_set__c,
                                     Form_3_Pens__c,
                                     Form_3_Pocket_money__c,
                                     Form_3_Safe_Term_Time_Accommodation__c,
                                     Form_3_Sanitary_Wear__c,
                                     Form_3_School_Bag__c,
                                     Form_3_Shoes__c,
                                     Form_3_Skirt__c,
                                     Form_3_Soap__c,
                                     Form_3_Socks__c,
                                     Form_3_Sugar__c,
                                     Form_3_Sweater__c,
                                     Form_3_Washing_powder__c,
                                     Form_4_Bata_shoes__c,
                                     Form_4_Bed_Sheets__c,
                                     Form_4_Blanket__c,
                                     Form_4_Blouse__c,
                                     Form_4_Calculator__c,
                                     Form_4_Counter_Books__c,
                                     Form_4_Dress__c,
                                     Form_4_Exercise_Books__c,
                                     Form_4_Hardcover_books__c,
                                     Form_4_Maths_set__c,
                                     Form_4_Pens__c,
                                     Form_4_Pocket_money__c,
                                     Form_4_Safe_Term_Time_Accommodation__c,
                                     Form_4_Sanitary_Wear__c,
                                     Form_4_School_Bag__c,
                                     Form_4_Shoes__c,
                                     Form_4_Skirt__c,
                                     Form_4_Soap__c,
                                     Form_4_Socks__c,
                                     Form_4_Sugar__c,
                                     Form_4_Sweater__c,
                                     Form_4_Washing_powder__c,
                                     Form_5_Blouse__c,
                                     Form_5_Counter_Books__c,
                                     Form_5_Dress__c,
                                     Form_5_Exercise_Books__c,
                                     Form_5_Safe_Term_Time_Accommodation__c,
                                     Form_5_Sanitary_Wear__c,
                                     Form_5_Shoes__c,
                                     Form_5_Skirt__c,
                                     Form_6_Blouse__c,
                                     Form_6_Counter_Books__c,
                                     Form_6_Dress__c,
                                     Form_6_Exercise_Books__c,
                                     Form_6_Safe_Term_Time_Accommodation__c,
                                     Form_6_Sanitary_Wear__c,
                                     Form_6_Shoes__c,
                                     Form_6_Skirt__c
                              FROM District_Entitlement_Sheet__c
                              WHERE Year__c =: SearchCriteria.Year__c
                              AND Term__c =: SearchCriteria.Term__c
                              AND Sheet_Type__c =: SearchCriteria.Sheet_Type__c];
         if(DESs.size() == 0)
         {
            Apexpages.addMessage(new ApexPages.Message(ApexPages.Severity.INFO,''+'No records to Display')); 
         }
        
      } 
}

Hope someone can help or just give me an example I've searched and can't find an example of something like this.

 

Cheers

Dan

I am trying to write a trigger to chang the quotelineitem's sort order by copying the item number, which is a custom field. I am recieving the following error:

 

Compile Error: Field is not writeable: QuoteLineItem.SortOrder

 

Here is my code:

trigger LineItemSortOrder on QuoteLineItem (Before Insert, Before Update) {
    
    QuoteLineItem[] q = trigger.new;

   for (integer i = 0; i < q.size(); i++) {
      QuoteLineItem nquote = q[i];
      nquote.sortorder = integer.valueof(nquote.Item__c);
  
   }    
    
}

 

Is there any way around this error?

 

Thank you,

ckellie