Forum Replies Created

Page 5 of 12
  • Hi Aman,

    This totally depends upon our requirement. If we need 2 or 3 fields from the Response then we don't need to create an additional class. If our response size is large then probably we can make use of an apex class. Thus it all depends upon requirement.

    Thanks.

  • Manpreet

    Member
    January 30, 2018 at 3:40 pm in reply to: Does Metadata Describes call consume API limits?

    Hi Radhakrishna,

    If you are talking about describe calls from apex, then no, they don't consume the limits.

    Thanks.

  • Hi Radhakrishna,

    Not natively, but here is a free app by the name "Create Files, Attachments and Documents Offline - By Formyoula Forms" on App Exchange that allows it.

    Thanks.

  • Manpreet

    Member
    January 30, 2018 at 3:33 pm in reply to: Capability of partial copy sandbox template in Salesforce

    Hi Harshita,

    Both these options are correct.Sandbox templates allow you to pick specific objects and data to copy to your Full or Partial Copy sandbox to control the size and content of each sandbox. Sandbox templates are only available for use with Full or Partial Copy sandboxes.

    When you create a sandbox template, you select the object data (standard and custom) to copy during the creation or refresh of a sandbox.

    The sandbox template editor understands the relationships that are defined in your Salesforce org’s object schema. Some objects are included even before you’ve selected anything because they’re required in any org. As you select objects to copy, the editor ensures that the associated required objects are added. To see which related objects are required by an object, select it in the Object table. Required objects are displayed in the Required Objects column.

    Thanks.

  • Manpreet

    Member
    January 30, 2018 at 3:27 pm in reply to: Salesforce Developer Job in Bengaluru - Mapeach

    Hi Manobala,

    I guess you have posted this in the wrong Forum.This forum is used to ask Questions regarding Salesforce.

    Thanks.

  • Manpreet

    Member
    January 30, 2018 at 3:27 pm in reply to: Salesforce Opportunities - Germany

    Hi Adam,

    I guess you have posted this in the wrong Forum.This forum is used to ask Questions regarding Salesforce.

    Thanks.

  • Manpreet

    Member
    January 30, 2018 at 3:23 pm in reply to: Side Panel Error Outlook 2010 in Salesforce Lightning

    Hi Radhakrishna,

    This was a Know issue before salesforce for outlook 3.4.1.25. Please try to install the latest version of salesforce for outlook would resolve your issue. SFO3.4.1.25 is the lates version.

    Thanks.

  • Manpreet

    Member
    January 30, 2018 at 3:17 pm in reply to: Can anyone please share the highlights of "India Dreamin’ 2017"?

    Hi obivan,
    There were over 1,500 attendees. Students, freshers, professionals, and yes even young children too.
    HIGHLIGHT: India is HUNGRY to learn Salesforce!
    Everyone in India had a HUGE desire to learn Salesforce!

    People really appreciated the opportunity to learn and considered it a privilege.Hundreds of students and volunteers, in fact, the entire GL Bajaj faculty and student population, helped organize the event.There was a special cultural song and dance performance to end the event.

    Thanks.

  • Manpreet

    Member
    January 30, 2018 at 2:52 pm in reply to: Salesforce Developers wanted in Germany

    Hi Adam,

    I guess you have posted this in the wrong Forum.This forum is used to ask Questions regarding Salesforce.

    Thanks.

  • Hi Ankit,

    Static SOQL is one which you write in square brackets. It is good to use when you didn't have any dynamic changes in the SOQL query.

    For e.g when the fields names or where conditions is needed to be defined dynamically we didn't use static SOQL. Then we need to use dynamic SOQL.

    ________________________________________________________________________________

    DYNAMIC SOQL :

    public Boolean DynamicSOQL(string user_id, string yourField) {
    String query = 'SELECT ' + yourField + ' FROM Contact WHERE Id = ' + user_id;
    Contact[] myContacts = Database.query(query);

    if(myContacts.size() < 1){
    return false;
    }
    else{
    myContacts[0].put(yourField,false);
    Database.update(myContacts[0]);
    return true;
    }
    }

    STATIC SOQL:

    List<Contact> conList = [SELECT Id, LastName From Contact];

    ________________________________________________________________________________

    One DISADVANTAGE with DYNAMIC SOQL is it causes SOQL injection in where condition which fetching on the basis of some text. To avoid which we need to use String.escapeSingleQuotes. There is no possibility of these in STATIC SOQL.

    Thanks.

  • Hi James,

    Force.com for Amazon Web Services includes two main components:

    Access to Amazon Web Services S3: This component exposes the AWS Simple Storage System (S3) services natively in the Force.com environment. Apex code wraps the S3 API and access methods, making them directly available to your own application code - enabling application flows in a discrete and semantically rich fashion, including the ability to automatically add, remove or modify S3 objects based on workflow and data changes in a Force.com application.
    Access to Amazon Web Services EC2: This component is represented by pre-built Amazon Machine Images (AMIs) that have the full development environment necessary to extend Force.com. This includes language runtimes, configurations, and connections to associated API libraries,. Developers can use EC2 to simply instantiate the AMI and immediately begin development, without any additional configuration or installation procedures. The first AMI being made available is to use PHP with Force.com.

    What all you need to do is, get the Amazon wsdl file and parse it in your Salesforce. This will create stub class in your Salesforce org. and then You can use this class methods to integrate your Salesforce with S3.

    Thanks.

  • Manpreet

    Member
    January 30, 2018 at 12:00 pm in reply to: What is the difference between RPC or Document Style web services?

    Hi tanu,

    In document style web services, we can transport an XML message as part of SOAP request which is not possible in RPC style web service. Document style web service is most appropriate in some application where XML message behaves as document and content of that document can alter and intention of web service does not rely on the content of XML message.

    Thanks.

  • Hi tanu,

    There are 2 workarounds that I have found:

    1. Deploy the field first and then deploy the code separately. 2. Uncheck the “Strictly enforce picklist values” option in sandbox, deploy the field and code in the same deployment, then re-check “Strictly enforce picklist values” option in production.

    I have not seen this bug reported in Known Issues. I may just do that now. Hopefully this blog will help prevent you from spending too much time on a simple deployment.

    Happy coding!

  • Manpreet

    Member
    January 30, 2018 at 10:32 am in reply to: What to do in case I am getting Rest API error?

    Hi Rahul,

    API version is defined in different different ways depending on what you are doing with it.

    SOAP API calls
    REST API calls
    Apex
    Visualforce
    All of these (and other features that use API) are fixed in the code you write against them, allowing you to upgrade/update when it fits your company/project lifecycle. Integration uses different end points. Apex and Visualforce use metadata to define the version.

    Essentially there is only ever one version of Salesforce in production. Previous versions of the API are emulated for the purpose of integration and code resilience.

    So when you write your REST request (as that's what you've been using), you will use a URL like this, for instance:

    HTTP:GET
    /services/data/v26.0/sobjects/account/001B0000003nJhxxxx

    The v26.0 segment of the URL path is what stipulates the version. You can substitute any other previous or later version up to the current version (v33.0 for Spring 15, the current release).

    n some instances you will get a response, but a different result. For instance these two GETendpoints:

    /services/data/v26.0/sobjects/account/001B0000003nJhJIAU
    /services/data/v33.0/sobjects/account/001B0000003nJhJIAU

    The second returns a few extra fields that were added in the ensuing versions.So manage your strEndpointUrl in the code.

     

    Thanks.

  • Manpreet

    Member
    January 29, 2018 at 1:32 pm in reply to: How to overcome SOQL Injection Vulnerability in salesforce?

    Hi vikas,

    Suppose you have a search form and instead of typing a valid search parameter, User types something invalid text and that can make your SOQL query invalid and expose the unexpected result.

    The worst scenario could be if resultant data from a query supposed to be deleted.
    let's have one more quick example for this :

    I have a case where I want to delete the Account based on name entered in the input name field on page.
    Implementation can be like this :

    List<Account> listAccount = Database.query('Select id from Account where Name = \'' + nameField + '\' ');

    delete listAccount;

    It works great with a valid value.
    Now it can be worst if value of nameField is provided like :

    nameField = \' OR Id != null OR Type != \'
    So once the action will be performed, this will be bind-up with the query and resultant query will be like this :

    List<Account> listAccount = Database.query('Select id from Account where Name = \'\'\' OR ID != null OR Type != \'\' ');

    delete listAccount;

    So hopefully , you can see the monster here. It will delete the entire database for account records.

    Salesforce provides escape functions to get rid from SOQL injection.
    Solution can be one of the followings:
    Try to use STATIC queries as much as possible. STATIC query has inbuilt escaping.
    If dynamic query is needed , then all the search parameters should use escapeSingleQuotes() function.like
    List<Account> listAccount = Database.query('Select id from Account where Name = \'' + String.escapeSingleQuotes(nameField) + '\' ');
    String.escapeSingleQuotes method adds the escape character (\) to all single quotation marks in a string that is passed in from a user. The method ensures that all single quotation marks are treated as enclosing strings, instead of database commands.

     

    Thanks.

  • Manpreet

    Member
    January 29, 2018 at 1:30 pm in reply to: Google Polymer and salesforce

    Hi vikas,

    While Dreamforce launched Lightening, Google has launched Polymer.And using Google Polymer with Salesforce you can do variety of things like create Bootstrap Table Component to handle and display data Awesomely with a very small line of code, create opportunity or any other sobject amcharts etc.

    Import charting component (installed through unmanaged package) on your page

    <link rel="import" href="/apex/force_ui_amchart"/>

    Start using them : Listing some sample charts types

    ##<b>Sample Donut Chart : </b><br/>
    <force-amchart charttype="pielegend" sobject="Opportunity" titlefield="Name" valuefield="Amount"
    limitResults="50"></force-amchart>

    Thanks.

  • Manpreet

    Member
    January 29, 2018 at 1:26 pm in reply to: How can I use Polymer amCharts in Visualforce Pages?

    Hi vikas,

    You need to use amcharts libraries for that :

    <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/amcharts/3.10.0/amcharts.js"></script>
    <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/amcharts/3.10.0/pie.js"></script>
    <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/amcharts/3.10.0/serial.js"></script>
    <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/amcharts/3.10.0/funnel.js"></script>
    <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/amcharts/3.10.0/themes/dark.js"></script>

    Create 2 visualforce Pages :

    1.) force_ui_amchart.vfp

    <apex:page contentType="text/plain">
    <!--==============================================================-->
    <!--CDN resource for AMChart libraries -->
    <!--==============================================================-->
    <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/amcharts/3.10.0/amcharts.js"></script>
    <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/amcharts/3.10.0/pie.js"></script>
    <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/amcharts/3.10.0/serial.js"></script>
    <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/amcharts/3.10.0/funnel.js"></script>
    <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/amcharts/3.10.0/themes/dark.js"></script>
    <script>
    document.addEventListener('WebComponentsReady', function() {
    SFDC.launch({
    accessToken: "{!$API.Session_ID}",
    instanceUrl: "https://" + window.location.hostname
    });
    });
    </script>
    <!--==============================================================-->
    <!--Defining Polymer Element Template with Attributes -->
    <!--==============================================================-->
    <polymer-element name="force-amchart" attributes="charttype valuefield titlefield sobject limitResults orderby" noscript="true">
    <template>
    <style>
    #chartdiv {background: #3f3f4f;color:#ffffff;
    width : 100%;
    height : 500px;
    font-size : 11px;
    }
    width : 100%;
    height : 500px;
    font-size : 11px;
    }
    </style>
    <div id="chartdiv"></div>

    <!--======================================================================-->
    <!--Reusing Salesforce Mobile Pack Components to Query Salesforce sObject -->
    <!--======================================================================-->
    <force-sobject-collection id="obj_collection" sobject="{{sobject}}" querytype="soql" query="{{query}}" on-sync="{{updateChart}}"></force-sobject-collection>
    </template>
    <script>
    <!--===================================================================================-->
    <!-- Adding Events on the attributes with default chart type and results limit ---------->
    <!--===================================================================================-->

    Polymer('force-amchart', {
    observe: {
    sobject: 'ready',
    valuefield: 'ready',
    titlefield: 'ready',
    limitResults : 'ready',
    charttype: 'updateChart'
    },
    charttype: 'pie',
    valuefield: "",
    titlefield: "",
    limitResults : '5',
    ready: function() {
    this.query = "Select Id, " + this.valuefield + ", " + this.titlefield + " from " + this.sobject + " Order by "+ this.valuefield + " DESC limit " + this.limitResults ;
    },
    updateChart: function() {
    var data = [];
    this.$.obj_collection.collection.models.forEach(function(model) {
    data.push(model.attributes);
    });

    <!--============================================================================-->
    <!-- Chart Definiations : Refer http://www.amcharts.com/javascript-charts/ --->
    <!--============================================================================-->

    var barChart = {
    "type": "serial",
    "theme": "dark",
    "valueAxes": [{
    "gridColor":"#FFFFFF",
    "gridAlpha": 0.2,
    "dashLength": 0
    }],
    "dataProvider": data,
    "gridAboveGraphs": true,
    "startDuration": 1,
    "graphs": [{
    "balloonText": "[[category]]: <b>[[value]]</b>",
    "fillAlphas": 0.8,
    "lineAlpha": 0.2,
    "type": "column",
    "valueField": this.valuefield
    }],
    "valueAxes": [{
    "gridColor":"#FFFFFF",
    "gridAlpha": 0.2,
    "dashLength": 0
    }],
    "gridAboveGraphs": true,
    "startDuration": 1,
    "graphs": [{
    "balloonText": "[[category]]: <b>[[value]]</b>",
    "fillAlphas": 0.8,
    "fillColors": ['#1fc072', '#1fc072', '#1fc072', '#1fc072', '#1fc072', '#1fc072', '#1fc072', '#1fc072', '#1fc072', '#1fc072', '#349862', '#349862', '#349862', '#349862', '#349862', '#349862', '#349862', '#349862', '#349862', '#349862'],
    "gradientOrientation": "horizontal",
    "lineAlpha": 0.2,
    "type": "column",
    "valueField": this.valuefield
    }],
    "chartCursor": {
    "categoryBalloonEnabled": false,
    "cursorAlpha": 0,
    "zoomable": false
    },
    "categoryField": this.titlefield,
    "categoryAxis": {
    "gridPosition": "start",
    "gridAlpha": 0,
    "tickPosition":"start",
    "tickLength":20
    },
    "exportConfig":{
    "menuTop": 0,
    "menuItems": [{
    "icon": '/lib/3/images/export.png',
    "format": 'png'
    }]
    }
    };

    var pyramid =
    {
    "type": "funnel",
    "theme": "dark",
    "dataProvider": data,
    "balloon": {
    "fixedPosition": true
    },
    "valueField": this.valuefield,
    "titleField": this.titlefield,
    "marginRight": 210,
    "marginLeft": 50,
    "startX": -500,
    "rotate": true,
    "labelPosition": "right",
    "balloonText": "[[title]]: [[value]]n[[description]]",
    "exportConfig":{
    "menuItems": [{
    "icon": '/lib/3/images/export.png',
    "format": 'png'
    }]
    }
    }

    var barRotated =
    {
    "type": "serial",
    "theme": "dark",
    "pathToImages":"http://www.amcharts.com/lib/3/images/",
    "dataProvider": data,
    "startDuration": 1,
    "graphs": [{
    "balloonText": "[[category]]: <b>[[value]]</b>",
    "colorField": "color",
    "fillAlphas": 1,
    "fillColorsField": "fill",
    "lineAlpha": 0.1,
    "type": "column",
    "valueField": this.valuefield,
    "showHandOnHover": true
    }],
    "depth3D": 20,
    "angle": 30,
    "chartCursor": {
    "categoryBalloonEnabled": false,
    "cursorAlpha": 0,
    "zoomable": false
    },
    "categoryField": "country",
    "categoryAxis": {
    "gridPosition": "start",
    "labelRotation": 90
    },
    "chartCursor": {
    "categoryBalloonEnabled": false,
    "cursorAlpha": 0,
    "zoomable": false
    },
    "categoryField": this.titlefield,
    "categoryAxis": {
    "gridPosition": "start",
    "labelRotation": 45
    },
    "amExport":{}
    }

    var donutChart = {
    "type": "pie",
    "theme": "dark",
    "valueField": this.valuefield,
    "titleField": this.titlefield,
    "dataProvider": data,
    "startEffect": "elastic",
    "startDuration": 2,
    "labelRadius": 15,
    "innerRadius": "50%",
    "depth3D": 10,
    "angle": 15,
    "exportConfig":{
    menuItems: [{
    icon: 'https://www.amcharts.com/lib/3/images/export.png',
    format: 'png'
    }]
    }
    };

    var barline=
    {
    "type": "serial",
    "theme": "dark",
    "pathToImages": "/lib/3/images/",
    "autoMargins": false,
    "marginLeft":30,
    "marginRight":8,
    "marginTop":10,
    "marginBottom":26,

    "dataProvider": data,
    "valueAxes": [{
    "axisAlpha": 0,
    "position": "left"
    }],
    "startDuration": 1,
    "graphs": [{
    "alphaField": "alpha",
    "balloonText": "<span style='font-size:13px;'>[[title]] in [[category]]:<b>[[value]]</b> [[additional]]</span>",
    "dashLengthField": "dashLengthColumn",
    "fillAlphas": 1,
    "title": "Income",
    "type": "column",
    "valueField": this.valuefield,
    }, {
    "balloonText": "<span style='font-size:13px;'>[[title]] in [[category]]:<b>[[value]]</b> [[additional]]</span>",
    "bullet": "round",
    "dashLengthField": "dashLengthLine",
    "lineThickness": 3,
    "bulletSize": 7,
    "bulletBorderAlpha": 1,
    "bulletColor": "#FFFFFF",
    "useLineColorForBulletBorder": true,
    "bulletBorderThickness": 3,
    "fillAlphas": 0,
    "lineAlpha": 1,
    "title": "Expenses",
    "valueField": "expenses"
    }],
    "categoryField": this.titlefield,
    "categoryAxis": {
    "gridPosition": "start",
    "axisAlpha":0,
    "tickLength":0
    }
    }

    var pieChart = {
    "type": "pie",
    "theme": "dark",
    "valueField": this.valuefield,
    "titleField": this.titlefield,
    "dataProvider": data,
    "depth3D": 10,
    "balloonText": "[[title]]<br><span style='font-size:14px'><b>[[value]]</b> ([[percents]]%)</span>",
    "angle": 15,
    "exportConfig":{
    menuItems: [{
    icon: 'https://www.amcharts.com/lib/3/images/export.png',
    format: 'png'
    }]
    }
    };

    var piechartwithlegend = {
    "type": "pie",
    "theme": "dark",
    "legend": {
    "markerType": "circle",
    "position": "right",
    "marginRight": 80,
    "autoMargins": false
    },
    "dataProvider":data,
    "valueField": this.valuefield,
    "titleField": this.titlefield,
    "balloonText": "[[title]]<br><span style='font-size:14px'><b>[[value]]</b> ([[percents]]%)</span>",
    "exportConfig": {
    "menuTop":"0px",
    "menuItems": [{
    "icon": '/lib/3/images/export.png',
    "format": 'png'
    }]
    }
    };

    var chart = AmCharts.makeChart(this.$.chartdiv,
    (function(charttype) {
    switch(charttype) {
    case "bar": return barChart;
    case "pie": return pieChart;
    case "donut" : return donutChart;
    case "bar_rotate" : return barRotated;
    case "pyramid" : return pyramid;
    case "barline" : return barline;
    case "pielegend" : return piechartwithlegend;
    }
    })(this.charttype));
    }
    });
    </script>
    </polymer-element>
    </apex:page>

    ________________________________________________________________________________

    2.) amCharts.vfp

    <apex:page showChat="false" showHeader="false" standardStylesheets="false" >
    <script src="//cdnjs.cloudflare.com/ajax/libs/polymer/0.3.3/polymer.js"></script>
    <script src="//cdnjs.cloudflare.com/ajax/libs/polymer/0.3.3/platform.js"></script>
    <link rel="import" href="{!URLFOR($Resource.MobileUIElements, 'dist/mobile-ui-elements.html')}"/>
    <link rel="import" href="/apex/force_ui_amchart"/>

    <!--
    <b>Sample Donut Chart : </b><br/>
    <force-amchart charttype="donut" sobject="Opportunity" titlefield="Name" valuefield="Amount" limitResults="50"></force-amchart>
    <b>Sample Pie Chart : </b><br/>
    <force-amchart sobject="Opportunity" titlefield="Name" valuefield="Amount" limitResults="9" orderby="Amount" ordertype="DESC"></force-amchart>
    <br/>
    <b>Sample Pie Chart with Legend : </b><br/>
    <force-amchart charttype="pielegend" sobject="Opportunity" titlefield="Name" valuefield="Amount" limitResults="3" orderby="Amount" ordertype="DESC"></force-amchart>
    <br/>
    <b>Sample Bar Chart : </b><br/>
    <force-amchart charttype="bar" sobject="Opportunity" titlefield="Name" valuefield="ExpectedRevenue" orderby="Amount" ordertype="DESC" limitResults="7"></force-amchart>
    <br/>
    <b>Sample Bar Rotate with Slanted Title Chart : </b><br/>
    <force-amchart charttype="bar_rotate" sobject="Opportunity" titlefield="Name" valuefield="Probability" limitResults="10"></force-amchart>
    <br />

    <b>Sample Pyramid Chart : </b><br/>
    <force-amchart charttype="pyramid" sobject="Opportunity" titlefield="Name" valuefield="Probability" limitResults="10"></force-amchart>
    <br />
    <force-amchart charttype="barline" sobject="Opportunity" titlefield="Name" valuefield="Amount" limitResults="4"></force-amchart>
    <br />
    -->
    <b>Sample Pie Chart with Legend : </b><br/>
    <force-amchart charttype="pielegend" sobject="Opportunity" titlefield="Name" valuefield="Amount" limitResults="5" orderby="Amount" ordertype="DESC"></force-amchart>
    <br/>
    <br/>

    <force-amchart charttype="bar" sobject="Opportunity" titlefield="Name" valuefield="ExpectedRevenue" orderby="Amount" ordertype="DESC" limitResults="5"></force-amchart>
    <br/>

    </apex:page>

     

    Thanks.

  • Manpreet

    Member
    January 29, 2018 at 1:14 pm in reply to: Date validation in jQuery moment datepicker in Salesforce?

    Hi vikas,

    you can do something like this :

    <link rel="stylesheet" href="//code.jquery.com/ui/1.11.3/themes/smoothness/jquery-ui.css">
    <script src="//code.jquery.com/ui/1.11.3/jquery-ui.js"></script>

    <form id="profileForm" method="post" class="form-horizontal">
    <div class="form-group">
    <label class="col-xs-3 control-label">Date of birth</label>
    <div class="col-xs-5">
    <input type="text" class="form-control" name="dob" />
    </div>
    </div>

    <div class="form-group">
    <div class="col-xs-9 col-xs-offset-3">
    <button type="submit" class="btn btn-default">Validate</button>
    </div>
    </div>
    </form>

    <script>
    $(document).ready(function() {
    $('#profileForm')
    .formValidation({
    framework: 'bootstrap',
    icon: {
    valid: 'glyphicon glyphicon-ok',
    invalid: 'glyphicon glyphicon-remove',
    validating: 'glyphicon glyphicon-refresh'
    },
    fields: {
    dob: {
    validators: {
    notEmpty: {
    message: 'The date of birth is required'
    },
    date: {
    format: 'MM/DD/YYYY',
    message: 'The date of birth is not valid'
    }
    }
    }
    }
    })
    .find('[name="dob"]')
    .datepicker({
    onSelect: function(date, inst) {
    /* Revalidate the field when choosing it from the datepicker */
    $('#profileForm').formValidation('revalidateField', 'dob');
    }
    });
    });
    </script>

  • Hi shashank,

    You can do something like this:

    public class uploadData{

    public String naam{get;set;}
    public ID folderid{get;set;}
    public Blob file{get;set;}

    public void insrt(){

    Document d= new Document();

    d.name = naam;
    d.body=file; // body field in document object which holds the file.
    d.folderid='00l90000000inFEAAY'; //folderid where the document will be stored insert d;
    insert d;

    Case cs = new Case();
    cs.FirstExample__Comments__c = '<img src="https://rustagiankit-developer-edition--c.ap1.content.force.com/servlet/servlet.FileDownload?file='+d.id+'" width="500" height="281"></img>'; //FirstExample is namespace & Comments__c is Rich Text Area field
    cs.Status = 'New';
    cs.Origin = 'Web';
    insert cs;
    }
    }
    *************************************
    ***************VF page***************

    <apex:page controller="uploadData">
    <apex:form>
    <apex:outputLabel value="Document Name"></apex:outputLabel>
    <apex:inputText id="name" value="{!naam}"/>

    <apex:outputLabel value="Upload Document"></apex:outputLabel>
    <apex:inputfile value="{!file}"></apex:inputfile>

    <apex:commandButton value="Save" action="{!insrt}" id="save"/>
    </apex:form>
    </apex:page>
    **************************************
    NOTE :- If you have a existing image stored in the Document, then you can only refer to below mentioned snippet of code only :-
    Case cs = new Case();
    cs.FirstExample__Comments__c = '<img src="https://xyz-developer-edition--c.ap7.content.force.com/servlet/servlet.FileDownload?file=01590000000QPTY" width="400" height="320"></img>';
    cs.Status = 'New';
    cs.Origin = 'Web';
    insert cs;

    This is for Case object.You can do similar with Contact Object.

    Thanks.

  • Manpreet

    Member
    January 19, 2018 at 10:34 am in reply to: Can We add two owners on an account in Salesforce?

    Hi Piyush,
    There can only be one owner of an account. You can share an account with another user, or provide access through sharing rules, or role hierarchy.
    You can also set up Account Teams to share access. This can be done for specific accounts or all you current and future accounts.
    Thanks.

  • Manpreet

    Member
    January 18, 2018 at 5:24 am in reply to: Recently viewed accounts in Salesforce Lookup

    Hi Pranav,

    I looked into your Query and i think all Lookups in Salesforce reviews Data Alphabetically.Though when we enter any Object and see its recent Data it will be actual recents as per our insertion and updation.It is how their functionality is.Although you can create your custom lookup if that what you need.

    Hope it Helps,

    Thanks.

  • Manpreet

    Member
    January 18, 2018 at 5:13 am in reply to: Why formula fields can not be added as custom index in salesforce?

    Hi Saurabh,

    Formula fields are custom fields that can help you dynamically calculate the value of a field based on other fields, expressions, or values.As you can with any other field, you can use formula fields to filter SOQL queries. For example, you might write a query such as:
    [SELECT Id, Name FROM Contact WHERE FormulaField__c = '10'];
    Just because you can filter queries using a formula field doesn’t mean that you should, however. By default, formula fields don’t have underlying indexes, so they require full scans to find target records. They also have to calculate values on the fly because actual values are not stored in the database. So when an object has a lot of records, queries that filter using a formula field can be painfully slow.

    Thanks.

  • Manpreet

    Member
    January 18, 2018 at 5:10 am in reply to: How to split Address in Salesforce?

    Hi Bhanu,
    You can use a specific identifier to split the custom address field into address components and store in proper address fields.You should determine the identifier in your custom address field. Usually the identifier will be Comma(,).

    Custom Address Field value = 45, CLARENCE ST, SYDNEY, NSW 2000

    In your apex method,

    List<String> lstofAddress = object.customField__c.split(',');
    object.AddressField1 = lstStringAddress[0];
    object.AddressField2 = lstStringAddress[1];
    object.AddressField3 = lstStringAddress[2];
    object.AddressField4 = lstStringAddress[3];
    object.AddressField5 = lstStringAddress[4];

    Thanks.

  • Hi Radhika,

    Try to update the details from within the template editor? The buttons should be defaulted to the respective global actions. You can then customize what action they are connected to by speficfying it.Make sure to always use all lower case when referencing the global actions.

    Thanks.

  • Manpreet

    Member
    January 18, 2018 at 4:59 am in reply to: Getting an error while installing a new package from Appexchange

    Hi rohit,

    As we guessed it was indeed a bug . The fields were deleted on the front end but the data was there at backend systems on SFDC which they had to wipe out by running a script.

    Cheers!

Page 5 of 12