Posts

Showing posts from July, 2015

Javascript Remoting : Pass parameters from javascript to Salesforce standard object field

            Here we are going to pass the sobject from the java script to apex using javascript remoting to insert the record in the database.             Here we are going to use our custom object to pass parameter to apex and insert the record. I am using the custom object name as CustomObj__c . Then the controller name is MyCustomController. The code is given below Step 1:         Need to write javascript code to create the customobject mannually.  the customobject in javascript is given below               function CustomObj__c(){ this.Id= null; this.name__c = null; this.address__c = null;              } Then create the instance for the function. ie object var custObj = new CustomObj__c(); step 2:     Then assign the calue what you want to store. custObj.name__c = 'RamaKavanan'; ...

Visualforce Remoting Exception: Unexpected type for MyController.myMethod(CustomObject)

What happened in Background :                 This error mainly happened when the javascript object set incorrect type value to the object fields.            So we can check the assigned values. but every body normally check the value but not the field type with the assigned value             we need to check both of that.              After check again the error display means we need to check the date field value. because mainly the javascript remoting can set the default value as null. What kind of value set in date field it shows what kind of error happening is given below as deep,             1. null                      when using the null to assign the value than java script remoting throws the  Visualforce Remoting Exception: Unexpected type for Mo...

Access Static Resource in Visualforce Page

           Accessing salesforce static resource depends on the whether you want access standalone single file or you can access file with in archive such as .zip           1. You want access stand alone single file means use $Resource . filename. here filename indicate which file you want to import in visualforce page. We want to use   $Resource.filename with this {!}. other wise it throw the error the example is given below,             <apex:image url="{!$Resource.CoffeeImage}" /> or we can access using URLFOR to access the static resource             <script type="text/javascript" src="{!URLFOR($Resource.Mainjs)}"/>          2. Access static resource from the archive means use URLFOR function. this first parameter used to point out the archive name and second parameter used to indicate the file name which are ...