Forum Replies Created

Page 3 of 3
  • Yes this is possible but in that case you need to have external server where you can have your files/attachments and give a link of file in salesforce to download that file. When user clicks on that link, you need to perform the authentication and download the file by using external system APIs. Many servers are available to store your files like rackspace, amazon e.t.c. Let me know if you need more info on this.

  • Naman

    Member
    April 14, 2016 at 8:05 am in reply to: Why do we use Closure in Javascript?
  • We can't restrict/deactivate manage package trigger untill it is not operated with some condition like we have custom setting checkbox checked to initiate the trigger. If you want to still update the accounts, you have to use the Salesforce APIs to update accounts OR you can make custom webservice in Salesforce and call it by authenticating salesforce. By that way the context would get change of both transactions. Let me know if you need more detail.

  • Naman

    Member
    April 14, 2016 at 7:53 am in reply to: Move Custom Javascript Buttons to Salesforce1

    Try using global action to achieve that in lightning.

  • Use java scripting to query object with inner query for Attachment. Like below

    sforce.connection.sessionId = '{!$Api.Session_ID}';
    var str='';
    var results = sforce.connection.query("SELECT Id,guid__c, (SELECT Id, Name FROM Attachments) FROM Application__c where guid__c ='{!$CurrentPage.parameters.guid}' limit 1");
    var records1 = results.getArray("records");

    (or)

    you can query in your controller check if attachment is there on object record, if yes, you can set a boolean to true and use that on page.

  • Yes that is possible. Try using Salesforce Messaging.SingleEmailMessage functionality.

    https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_email_outbound_single.htm

  • Try something like below: Note that reference field must be external id field on parent object. Here i have used SLASerialNumber__c  as external id field.

    Contact con = new Contact(lastName='bhardwaj');
    con.Email = '[email protected]';

    Account accRef = new Account(SLASerialNumber__c='12');
    con.Account = accRef;

    Account acc = new Account(Name='namanTestAcc', SLASerialNumber__c='12');

    Database.SaveResult[] results = Database.insert(new SObject[] {acc, con});

    for (Integer i = 0; i < results.size(); i++) {
    if (results[i].isSuccess()) {
    System.debug('Successfully Created ID: '+ results[i].getId());
    }
    }

  • Naman

    Member
    April 14, 2016 at 7:27 am in reply to: Asynchronous method call to fetch data at particular time interval

    You can use Action Poller to call action from Controller asynchronously at particular time interval. Also you need to use "enabled" attribute to put some trick there to stop calling action.

  • Above was the one solution that Salesforce support gave initially. After using batch class too, trigger was not able to perform the operations so again contacted with Salesforce support and finally they enabled the custom indexing for some fields(in my case on account fields) which i have to use in my WHERE clause. This made my query run successfully and no more of "Non-selective query" error message come.

  • Naman

    Member
    April 1, 2016 at 11:03 am in reply to: Enable Quotes and Order using Post install Script

    Hi Bhavesh,

    We can only enable the Quotes and Order settings either by point and click or by using Metadata APIs. See the below link -

    https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_quotessettings.htm
    https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_ordersettings.htm

    We can use the above links info in apex class like below

    HTTP h = new HTTP();
    HTTPRequest req = new HTTPRequest();
    req.setMethod('POST');
    req.setHeader('Content-Type', 'text/xml');
    req.setHeader('SOAPAction', 'create');

    String b = '';
    b += '';
    b += 'true';
    b += '
    ';
    req.setBody(b);
    req.setCompressed(false);
    req.setEndpoint('https://na12-api.salesforce.com/services/Soap/m/25.0');
    HTTPResponse resp = h.send(req);

    In apex, we can do only simple CRUD operations using Metadata APIs.

  • Naman

    Member
    March 30, 2016 at 7:35 am in reply to: Add a value in Datalist using Jquery

    Hi Satyakam.

    You can use typeahead library of jquery in you VF page that can help you achieve the same functionality. Whenever user would select any value from data list, you can get that using typeahead:selected and remove that value from your datalist by writing custom remove function. As needed, you can use the selected value to display it on another div with checkbox and when user checks the checkbox, you can again add the value into the original datalist by using javascript push() function.

    $('#the-basics .typeahead').typeahead({
    hint: true,
    highlight: true,
    minLength: 1
    },
    {
    name: 'states',
    source: substringMatcher(states)
    }).bind("typeahead:selected", function(obj, datum) {
    alert('datum '+datum);
    states.remove(datum);
    //document.getElementById("inputTextTypeahead").value = '';

    states2.push(datum);
    alert('states2 '+states2);
    document.getElementById("demo").innerHTML = states2;

    });

    Note: datum is the selected value that user selects from the datalist. States is the data list.

    Following is the remove function that will remove the selected value from the original data list.

    Array.prototype.remove = function() {
    var what, a = arguments, L = a.length, ax;
    while (L && this.length) {
    what = a[--L];
    while ((ax = this.indexOf(what)) !== -1) {
    this.splice(ax, 1);
    }
    }
    return this;
    };

  • I have been touch with Salesforce support and also created case regarding the same. When trigger gives an error like above and you have tried almost everything to resolve it, that means your trigger exceeding the CPU time limit so the alternative solution could be a batch class processing the records.

Page 3 of 3