Forum Replies Created

Page 9 of 9
  • Abhinav

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

    Yes it is possible.

    HttpRequest request = new HttpRequest();
    request = new HttpRequest();
    request.setEndpoint('https://ap2.salesforce.com/services/Soap/m/31.0');
    request.setMethod('POST');
    request.setHeader('Content-Type', 'text/xml');
    request.setHeader('SOAPAction', 'update');
    String b = '<?xml version="1.0" encoding="UTF-8"?>';
    b += '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">';
    b += '<soapenv:Header>';
    b += '<ns1:SessionHeader soapenv:mustUnderstand="0" xmlns:ns1="http://soap.sforce.com/2006/04/metadata">';
    b += '<ns1:sessionId>' + UserInfo.getSessionId() + '</ns1:sessionId>';
    b += '</ns1:SessionHeader>';
    b += '</soapenv:Header>';
    b += '<soapenv:Body>';

    b += '<update xmlns="http://soap.sforce.com/2006/04/metadata">';
    b += '<UpdateMetadata>';
    b += '<currentName>QuoteSettings</currentName>';

    b += '<metadata xsi:type="ns2:QuoteSettings" xmlns:ns2="http://soap.sforce.com/2006/04/metadata">';

    b += '<fullName>QuoteSettings</fullName>';
    b += '<enableQuote>true</enableQuote>';

    b += '</metadata>';
    b += '</UpdateMetadata>';
    b += '</update>';
    b += '</soapenv:Body>';
    b += '</soapenv:Envelope>';
    request.setBody(b);
    request.setCompressed(false);

    //request.setHeader('Authorization', 'OAuth ' + SESSION_ID);

    String body = (new Http()).send(request).getBody();
    system.debug('Hello from body'+body);

    • This reply was modified 7 years, 11 months ago by  Abhinav.
  • Abhinav

    Member
    April 11, 2016 at 11:24 am in reply to: How to use Post Install Script to enable Quotes and Order object?

    Yes it is possible.

    HttpRequest request = new HttpRequest();
    request = new HttpRequest();
    request.setEndpoint('https://ap2.salesforce.com/services/Soap/m/31.0');
    request.setMethod('POST');
    request.setHeader('Content-Type', 'text/xml');
    request.setHeader('SOAPAction', 'update');
    String b = '<?xml version="1.0" encoding="UTF-8"?>';
    b += '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">';
    b += '<soapenv:Header>';
    b += '<ns1:SessionHeader soapenv:mustUnderstand="0" xmlns:ns1="http://soap.sforce.com/2006/04/metadata">';
    b += '<ns1:sessionId>' + UserInfo.getSessionId() + '</ns1:sessionId>';
    b += '</ns1:SessionHeader>';
    b += '</soapenv:Header>';
    b += '<soapenv:Body>';

    b += '<update xmlns="http://soap.sforce.com/2006/04/metadata">';
    b += '<UpdateMetadata>';
    b += '<currentName>QuoteSettings</currentName>';

    b += '<metadata xsi:type="ns2:QuoteSettings" xmlns:ns2="http://soap.sforce.com/2006/04/metadata">';

    b += '<fullName>QuoteSettings</fullName>';
    b += '<enableQuote>true</enableQuote>';

    b += '</metadata>';
    b += '</UpdateMetadata>';
    b += '</update>';
    b += '</soapenv:Body>';
    b += '</soapenv:Envelope>';
    request.setBody(b);
    request.setCompressed(false);

    String body = (new Http()).send(request).getBody();
    system.debug('response'+body);

    • This reply was modified 7 years, 11 months ago by  Abhinav.
  • Use long Data Type to store value greater than 2,147,483,647...You can store upto (2^64)-1 value in long datatype.
    Example:
    Long x = 21474836478l;

    • This reply was modified 7 years, 12 months ago by  Abhinav.
  • You can create the global action using VF page. And on the click of that global action visual force page will open up and it will simply redirect to the URL where you want to redirect. This will open the URL on the same window not in another window.

    Use the following in the script of the VF page :-

    window.open("/one/demoPage","_parent");

    Where demoPage is my VF page.

    I hope this help.

    • This reply was modified 8 years ago by  Abhinav.
  • Abhinav

    Member
    March 30, 2016 at 2:29 pm in reply to: Picklist in formula Field?
  • Abhinav

    Member
    March 25, 2016 at 6:33 am in reply to: Order Of Events Execution?

    Order of events execution(Validation Rules, Trigger, Workflow rule, Assignment rule) when saving the record : -
    1. Executes all before triggers.
    2. Runs most system validation steps again, such as verifying that all required fields have a non-null value, and runs any user-defined validation rules. The only system validation that Salesforce doesn't run a second time (when the request comes from a standard UI edit page) is the enforcement of layout-specific rules.
    3. Executes all after triggers.
    4. Executes assignment rules.
    5. Executes workflow rules.
    6. If there are workflow field updates, updates the record again.
    7. If the record was updated with workflow field updates, fires before update triggers and after update triggers one more time (and only one more time), in addition to standard validations. Custom validation rules, duplicate rules, and escalation rules are not run again.

Page 9 of 9