Forum Replies Created

Viewing 1 - 25 of 40 posts
  • Shubham

    Member
    July 12, 2019 at 1:40 pm

    Hi Prakhar,

    You can create envelope by making a HTTP post request to the following endpoint :

    POST /v2.1/accounts/{accountId}/envelopes

    and adding the following parameters in the request : status,emailSubject,documents,recipients

    For more details you can refer to API references of the documentation  : https://developers.docusign.com/esign-rest-api/reference/Envelopes/Envelopes/create

  • Shubham

    Member
    April 26, 2018 at 2:05 pm

    Hi Pranav, this error usually occurs when Nintex Drawloop app is upgraded in your org and you try to generate document(send DDP's) using O365 sharepoint delivery option. When the app is upgraded you have to re-authorize the existing O365 integration by going to Docgen Admin tab again. Follow the below steps:

    1) Go to Docgen Admin tab.

    2) Select Configuration tab and click on Third Party Integrations.

    3) Edit existing O365 connection and Click on Reauthorize button.

    4) Enter the same credentials with which O365 connection was created previously and login.
    Once the above steps are performed you can generate Documents(send DDP's) to O365 sharepoint without any error.

    • This reply was modified 3 years, 7 months ago by  Shubham.
    • This reply was modified 3 years, 7 months ago by  Shubham.
  • Shubham

    Member
    April 26, 2018 at 12:44 pm

    Hi Saurabh, as the error says it seems like your target org has an older version of Nintex drawloop app installed. Upgrading the app to the latest version in target org should fix the issue.

  • Shubham

    Member
    April 26, 2018 at 12:17 pm

    Hi Meddimala , Can you please elaborate your requirement more ?

  • Shubham

    Member
    April 26, 2018 at 11:24 am

    To solve this scenario, you can create after insert trigger on opportunity and add simple logic to Insert a task to the related account when Opportunity's account have more than or equal to 3 opportunities.

  • Shubham

    Member
    February 26, 2018 at 3:41 pm

    Hi Saloni

    You can get the old value of a field in Apex VF controller by writing following line of code in the constructor of your Apex controller.

    oldRecord = controller.getRecord().clone();

    If you want to do it only in Vf page then you will need to clone the original object.

    Hope it may helps.

     

  • Shubham

    Member
    February 26, 2018 at 2:58 pm

    Hi Ankit

    You can achieve this by going into the Approver field and Record editability in the edit button of Approver process.

    In that section under the Record Editability Properties

    select "Administrators OR the currently assigned approver can edit records during the approval process." radio button.

    Hope it may helps

  • Shubham

    Member
    February 26, 2018 at 2:30 pm

    Hi Ankit

    No. Campaign Member Status values are Campaign-specific, and are considered metadata (configuration), not data. Process Builder only works with data.

    Hope it may helps.

  • Shubham

    Member
    February 26, 2018 at 2:21 pm

    Hello Saurabh

    You can achieve this by creating relationship in your docgen packages.

    • Go to your Docgen packages.
    • Click on to the New Relationship Button
    • For Type dropdown :Select salesforce Object
    • For Related By (What you have) :Select the object on which you are working.In this case select your parent object.
    • Relationship (What you want): Select child object which you want to show on to the table.In this case child object of your parent object.
    • Related By: Select relationship between them.
    • Click on save button.
    • After clicking on save button you will a new relationship created in your docgen package.Click on the edit link of the relationship
    • In the Relationship Alias: Give a unique alias which differentiate this relationship with others relationship
    • In the Copy type: Select Table
    • If you want to show it any order then in the Order Relationship by select field from the dropdown and select Descending if you want to show in Descending order.
    • Click on save button
    • Now go to the Field Tagger select your child object as Main object after that use  Replicate Table tag from the field tags section in your template.
    • On generating document It will generate dynamic table which shows child object related list of parent object

    Hope it may helps

  • Shubham

    Member
    February 26, 2018 at 1:52 pm

    Hi Ankit

    Yes you can do it by enabling setting in the salesforce.

    Salesforce has also provided a new preference setting to help facilitate the change over to Files from Notes & Attachments. "Files uploaded to the Attachments related list on records are uploaded as Salesforce Files, not as attachments" has been introduced to ensure that Attachments added via Notes & Attachments related list are now uploaded as Files moving forward. You can make this change by following the below steps:
    1-Click on setup
    2-Search "Salesforce Files" in quick find box and click on 'General setting'.
    3-Click on edit button.
    4-Click on this checkbox 'Files uploaded to the Attachments related list on records are uploaded as Salesforce Files, not as attachments'.
    5-Click on save button.

    Hope it may helps.

  • Shubham

    Member
    February 26, 2018 at 1:49 pm

    Hi SuryaDeep

    Email class Contains methods common to both single and mass email.

    The following are methods for Email. All are instance methods.
    setBccSender(bcc)
    Indicates whether the email sender receives a copy of the email that is sent. For a mass mail, the sender is only copied on the first email sent.
    setReplyTo(replyAddress)
    Optional. The email address that receives the message when a recipient replies.
    setTemplateID(templateId)
    The ID of the template to be merged to create this email. You must specify a value for setTemplateId, setHtmlBody, or setPlainTextBody. Or, you can define both setHtmlBody and setPlainTextBody.
    setSaveAsActivity(saveAsActivity)
    Optional. The default value is true, meaning the email is saved as an activity. This argument only applies if the recipient list is based on targetObjectId or targetObjectIds. If HTML email tracking is enabled for the organization, you will be able to track open rates.
    setSenderDisplayName(displayName)
    Optional. The name that appears on the From line of the email. This cannot be set if the object associated with a setOrgWideEmailAddressId for a SingleEmailMessage has defined its DisplayName field.
    setUseSignature(useSignature)
    Indicates whether the email includes an email signature if the user has one configured. The default is true, meaning if the user has a signature it is included in the email unless you specify false.

    Hope it may helps

  • Shubham

    Member
    February 16, 2018 at 8:10 am

    Hi Raghav

    Here are the few highlights of salesforce API version 40

    1-Summer ’17 Salesforce Classic Only Highlights

    • Lightning Experience Migration Assistant
    • Update existing Letterhead email templates by changing which letterhead is associated with the template.
    • Stay-in-Touch feature officially retires. The Request Update button will be removed in Summer 17.
    • Cloud Scheduler retirement: Unavailable in Salesforce orgs created in Winter ‘17 or later. If you enabled Cloud Scheduler before Winter ‘17, it remains available until Winter ’18.

    2-Summer ’17 Salesforce Lightning Experience Only Highlights

    • Search Enhancement: Find the right opportunity by searching for opportunity name plus the account name.
    • Manage Records Using Split View for Console Apps. When you have a console app, rather than show a list view as a table, you can select to show the list view as a split view. This allows your reps to work with multiple records at a time.
    • Rich Text Editors Reenabled for LockerService. Previously, when LockerService was activated in a sandbox or personal DE, the rich text editor became disabled.
    • “Disable Access to Lightning Experience and the Salesforce1 Mobile Browser App from IE11” Critical Update Canceled

    3-Summer ’17 Salesforce Classic & Lightning Experience Highlights

    • Remove the ability for users to switch back to Classic. By enabling the “Hide Option to Switch to Salesforce Classic” on the profile or permission set, this disallows the user from switching between Classic and Lightning.
    • Orders are now available via global actions
    • Person Accounts now shows all notes
    • Find duplicates between contacts and leads

    More new changes you can find by going through Salesforce Summer '17 - Salesforce Release Notes

    Hope this may help you

    Thanks

  • Shubham

    Member
    January 16, 2018 at 2:29 pm

    Can you please elaborate more what is your query ?

  • Shubham

    Member
    January 16, 2018 at 2:18 pm

    Hello Deepak,

    After reviewing your code i found that you are not using "Bearer" in your header. Try changing your authorization header as below and run your code again.

    req.setHeader('Authorization','Bearer '+tmpGD.Access_Token__c );

    If still error persists then try to check "Allow users to install Google Drive apps" option is enabled by going to Google Drive setting. We also receive "Forbidden" error if this option is disabled.

    Let me know if this fixes the issue.

  • Shubham

    Member
    January 16, 2018 at 1:42 pm

    @isTest annotation is used to define the test classes which contains code to test your application and these classes does not count against your over all code coverage.

    Syntax Example:

    @isTest
    private class MyTest {
    // Methods for testing
    }

    testmethod keyword is used to define apex test methods. Also test methods can be defined in any apex class. But we ideally use apex test methods in test classes with @isTest annotation.

    We can also use  @isTest to define apex test methods which is equivalent to the testMethod keyword.

    Syntax Example:

     

    @isTest
    public class myClass {
    static testMethod void myTest() {
    // Add test method logic here
    }
    }

  • Shubham

    Member
    January 9, 2018 at 1:42 pm

    We can add maximum of 20 components (reports) in a dashboard.

  • Shubham

    Member
    October 3, 2016 at 10:52 am

    Hi Pranav,

    I am assuming that you have a list of records and you want to 'select all' using single checkbox to do some sort of operation/action on the selected records. So to create 'check-uncheck all' functionality in your VF page, I think using Javascript would be the best option as JavaScript runs client side, 'check-uncehck' all functionality would be fast as compared to apex. If your requirement is to use apex . Here is a sample code : -

    VF page : 

    <apex:page controller="checkUncheckAllCntrl" tabStyle="Account">
    <apex:form id="theForm">
    <apex:pageBlock>
    <apex:pageBlockButtons>
    <apex:commandButton value="Do Some Action"/>
    </apex:pageBlockButtons>
    <apex:pageBlockSection title="List of Accounts">
    <apex:pageBlockTable value="{!wrapperAccList}" var="acc">
    <apex:column>
    <apex:facet name="header">
    <apex:inputCheckbox id="mainBox" value="{!mainBoxValue}" onChange="CallAction();return false;">
    <apex:actionSupport event="onclick" action="{!checkUncheckAll}" reRender="theForm"/>
    </apex:inputCheckbox>
    </apex:facet>
    <apex:inputCheckbox value="{!acc.flag}"/>
    </apex:column>
    <apex:column value="{!acc.accObj.Name}"/>
    </apex:pageBlockTable>
    </apex:pageBlockSection>
    </apex:pageBlock>
    </apex:form>
    </apex:page>

    Controller :

    public class CheckUncheckAllCntrl {
    public Boolean mainBoxValue{get;set;}
    public List<checkBoxWrapper> wrapperAccList{get;set;}

    public CheckUncheckAllCntrl(){
    wrapperAccList = new List<checkBoxWrapper>();
    for(Account acc :[Select Id,Name,OwnerId from Account limit 10]){
    wrapperAccList.add(new CheckBoxWrapper(false,acc));
    }
    }

    public void checkUncheckAll(){
    for(CheckBoxWrapper wrapObj : wrapperAccList){
    wrapObj.flag = mainBoxValue;
    }
    }

    public class CheckBoxWrapper{
    public Boolean flag{get;set;}
    public Account accObj{get;set;}

    public CheckBoxWrapper(Boolean flagValue,Account accObj){
    this.flag = flagValue;
    this.accObj = accObj;
    }
    }
    }

     

  • Shubham

    Member
    August 8, 2016 at 3:28 pm

    You can call the function of the Custom Controller from the Javascript using action function. Here is a simple example

    VF page

    <apex:page controller="myController">

    <script>
    function callJavaScript(){
    callAction();
    }
    </script>

    <apex:actionFunction action="{!myMethod}" name="callAction" reRender="none"/>
    <button onclick="callJavaScript();">Call Action Function</button>

    </apex:page>

    Controller

    public class myController{

    public myController(){}

    public void myMethod(){
    system.debug('Method called');
    }
    }

  • Shubham

    Member
    July 26, 2016 at 12:57 pm

    Hi Tanu,

    You can achieve this by Creating a javascript custom button on opportunity and apex class. Here is the code

    Apex Class

    global class DisableInputTextCntrl {

    public static List<String> downloadUrlList;
    public static List<Attachment> attachmentList;

    webservice static List<String> download(String oppId){

    downloadUrlList = new List<String>();
    attachmentList = [select id from attachment where ParentId =:oppId];

    if(!attachmentList.isEmpty()){
    for(Attachment attach : attachmentList){
    String url = '/servlet/servlet.FileDownload?file='+string.valueOf(attach.id);
    downloadUrlList.add(url);
    }
    }

    return downloadUrlList;
    }
    }

    Custom Button Code

    {!REQUIRESCRIPT("/soap/ajax/15.0/connection.js")}
    {!REQUIRESCRIPT("/soap/ajax/15.0/apex.js")}

    (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.multiDownload = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
    'use strict';

    function fallback(urls) {
    var i = 0;

    (function createIframe() {
    var frame = document.createElement('iframe');
    frame.style.display = 'none';
    frame.src = urls[i++];
    document.documentElement.appendChild(frame);

    // the download init has to be sequential otherwise IE only use the first
    var interval = setInterval(function () {
    if (frame.contentWindow.document.readyState === 'complete') {
    clearInterval(interval);

    // Safari needs a timeout
    setTimeout(function () {
    frame.parentNode.removeChild(frame);
    }, 1000);

    if (i < urls.length) {
    createIframe();
    }
    }
    }, 100);
    })();
    }

    function isFirefox() {
    // sad panda 🙁
    return /Firefox\//i.test(navigator.userAgent);
    }

    function sameDomain(url) {
    var a = document.createElement('a');
    a.href = url;

    return location.hostname === a.hostname && location.protocol === a.protocol;
    }

    function download(url) {
    var a = document.createElement('a');
    a.download = '';
    a.href = url;
    // firefox doesn't support `a.click()`...
    a.dispatchEvent(new MouseEvent('click'));
    }

    module.exports = function (urls) {
    if (!urls) {
    throw new Error('`urls` required');
    }

    if (typeof document.createElement('a').download === 'undefined') {
    return fallback(urls);
    }

    var delay = 0;

    urls.forEach(function (url) {
    // the download init has to be sequential for firefox if the urls are not on the same domain
    if (isFirefox() && !sameDomain(url)) {
    return setTimeout(download.bind(null, url), 100 * ++delay);
    }

    download(url);
    });
    }

    },{}]},{},[1])(1)
    });

    (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.multiDownload = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
    'use strict';

    function fallback(urls) {
    var i = 0;

    (function createIframe() {
    var frame = document.createElement('iframe');
    frame.style.display = 'none';
    frame.src = urls[i++];
    document.documentElement.appendChild(frame);

    // the download init has to be sequential otherwise IE only use the first
    var interval = setInterval(function () {
    if (frame.contentWindow.document.readyState === 'complete') {
    clearInterval(interval);

    // Safari needs a timeout
    setTimeout(function () {
    frame.parentNode.removeChild(frame);
    }, 1000);

    if (i < urls.length) {
    createIframe();
    }
    }
    }, 100);
    })();
    }

    function isFirefox() {
    // sad panda 🙁
    return /Firefox\//i.test(navigator.userAgent);
    }

    function sameDomain(url) {
    var a = document.createElement('a');
    a.href = url;

    return location.hostname === a.hostname && location.protocol === a.protocol;
    }

    function download(url) {
    var a = document.createElement('a');
    a.download = '';
    a.href = url;
    // firefox doesn't support `a.click()`...
    a.dispatchEvent(new MouseEvent('click'));
    }

    module.exports = function (urls) {
    if (!urls) {
    throw new Error('`urls` required');
    }

    if (typeof document.createElement('a').download === 'undefined') {
    return fallback(urls);
    }

    var delay = 0;

    urls.forEach(function (url) {
    // the download init has to be sequential for firefox if the urls are not on the same domain
    if (isFirefox() && !sameDomain(url)) {
    return setTimeout(download.bind(null, url), 100 * ++delay);
    }

    download(url);
    });
    }

    },{}]},{},[1])(1)
    });

    var Id = '{!Opportunity.Id}';
    var arrayId = [];
    arrayId = sforce.apex.execute("DisableInputTextCntrl","download",{oppId:Id});

    if(arrayId.length > 0){
    multiDownload(arrayId);
    }

     

     

     

  • Shubham

    Member
    July 26, 2016 at 10:23 am

    Hi Tanu,

    Try this code

    1. Using apex input checkbox and apex input text

    VF page

    <apex:page controller="DisableInputTextCntrl">
    <script>
    function myFunction(checkboxId){
    var flag = document.getElementById(checkboxId).checked;
    callAction(flag);
    }
    </script>
    <apex:form>
    <apex:actionFunction name="callAction" reRender="yourText" action="{!changeFlag}">
    <apex:param value="" name="flagValue"/>
    </apex:actionFunction>
    <apex:inputCheckbox id="yourBox" styleClass="test" onclick="myFunction('{!$Component.yourBox}')"/>
    <apex:inputText id="yourText" disabled="{!(!flag)}"/>

    </apex:form>
    </apex:page>

    Controller

    public class DisableInputTextCntrl {
    public boolean flag{get;set;}

    public DisableInputTextCntrl(){
    flag = false;
    }

    public void changeFlag(){
    flag = boolean.valueOf(ApexPages.currentPage().getParameters().get('flagValue'));
    }
    }

    2. Using HTML input checkbox and input text

    VF page

    <apex:page>

    <input type="text" id="yourText" disabled="true" />
    <input type="checkbox" id="yourBox" />
    <script>
    document.getElementById('yourBox').onchange = function() {
    document.getElementById('yourText').disabled = !this.checked;
    };
    </script>
    </apex:page>

  • Shubham

    Member
    July 21, 2016 at 7:26 am

    Hi Pranav,

    You can do this with the help of apex and VF page. Here is a sample code you can use and customize as per your requirement.

    VF page

    <apex:page controller="CopyContactsController" tabStyle="Account">
    <apex:form id="theForm">
    <apex:pageMessages />
    <apex:pageBlock title="Copy Contacts">
    Copy Contacts from Account ID <apex:inputText required="true" value="{!acc1Id}"/>
    Copy Contacts to Account ID <apex:inputText required="true" value="{!acc2Id}"/>

    <apex:pageBlockButtons >
    <apex:commandButton action="{!copyContacts}" value="Copy Contacts" reRender="theForm"/>
    </apex:pageBlockButtons>
    </apex:pageBlock>
    </apex:form>
    </apex:page>

    Controller

    public class CopyContactsController {
    public String acc1Id{get;set;}
    public String acc2Id{get;set;}
    public List conList;

    public CopyContactsController(){}

    public void copyContacts(){
    conList = new List();
    try{
    for(Contact con :[select lastname,email,phone from contact where AccountId =:acc1Id]){
    Contact contoAdd = new Contact(
    LastName = con.LastName,
    AccountId = acc2Id,
    Email = con.Email,
    Phone = con.phone
    );
    conList.add(contoAdd);
    }
    insert conList;
    ApexPages.addmessage(new ApexPages.message(ApexPages.severity.CONFIRM,'Contacts Copied Successfully'));
    }catch(Exception e){
    ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error,e.getMessage()));
    }
    }
    }

    • This reply was modified 5 years, 4 months ago by  Shubham.
    • This reply was modified 5 years, 4 months ago by  Shubham.
  • Shubham

    Member
    July 20, 2016 at 3:49 pm

    Hi Pranav,

     

    You can do this with the help of apex and VF page. Here is a sample code you can use and customize as per your requirement.

    VF page

    [[code]]czo3NzU6XCImbHQ7YXBleDpwYWdlIGNvbnRyb2xsZXI9XFwmcXVvdDtDb3B5Q29udGFjdHNDb250cm9sbGVyXFwmcXVvdDsgdGFiU3R5bHtbJiomXX1lPVxcJnF1b3Q7QWNjb3VudFxcJnF1b3Q7Jmd0OwogICAgJmx0O2FwZXg6Zm9ybSBpZD1cXCZxdW90O3RoZUZvcm1cXCZxdW90OyZndDsKIHtbJiomXX0gICAgICAgJmx0O2FwZXg6cGFnZU1lc3NhZ2VzLyZndDsKICAgICAgICAmbHQ7YXBleDpwYWdlQmxvY2sgdGl0bGU9XFwmcXVvdDtDb3tbJiomXX1weSBDb250YWN0c1xcJnF1b3Q7Jmd0OwogICAgICAgICAgICBBY2NvdW50IDEgSUQgJmx0O2FwZXg6aW5wdXRUZXh0IHJlcXVpcmVkPXtbJiomXX1cXCZxdW90O3RydWVcXCZxdW90OyB2YWx1ZT1cXCZxdW90O3shYWNjMUlkfVxcJnF1b3Q7LyZndDsKICAgICAgICAgICAgQWNjb3VudCAyIHtbJiomXX1JRCAmbHQ7YXBleDppbnB1dFRleHQgcmVxdWlyZWQ9XFwmcXVvdDt0cnVlXFwmcXVvdDsgdmFsdWU9XFwmcXVvdDt7IWFjYzJJZH1cXCZxdXtbJiomXX1vdDsvJmd0OwogICAgICAgIAogICAgICAgICAgICAmbHQ7YXBleDpwYWdlQmxvY2tCdXR0b25zJmd0OwogICAgICAgICAgICAgICAge1smKiZdfSZsdDthcGV4OmNvbW1hbmRCdXR0b24gYWN0aW9uPVxcJnF1b3Q7eyFjb3B5Q29udGFjdHN9XFwmcXVvdDsgdmFsdWU9XFwmcXVvdDtDb3B7WyYqJl19eSBDb250YWN0c1xcJnF1b3Q7IHJlUmVuZGVyPVxcJnF1b3Q7dGhlRm9ybVxcJnF1b3Q7LyZndDsKICAgICAgICAgICAgJmx0Oy9hcGV4OntbJiomXX1wYWdlQmxvY2tCdXR0b25zJmd0OwogICAgICAgICZsdDsvYXBleDpwYWdlQmxvY2smZ3Q7ICAgIAogICAgJmx0Oy9hcGV4OmZvcm0me1smKiZdfWd0OwombHQ7L2FwZXg6cGFnZSZndDtcIjt7WyYqJl19[[/code]]

    Controller

    [[code]]czo5NjU6XCJwdWJsaWMgY2xhc3MgQ29weUNvbnRhY3RzQ29udHJvbGxlciB7CiAgICBwdWJsaWMgU3RyaW5nIGFjYzFJZHtnZXQ7c2V7WyYqJl19dDt9CiAgICBwdWJsaWMgU3RyaW5nIGFjYzJJZHtnZXQ7c2V0O30KICAgIHB1YmxpYyBMaXN0Jmx0O0NvbnRhY3QmZ3Q7IGNvbkxpc3tbJiomXX10OwogICAgCiAgICBwdWJsaWMgQ29weUNvbnRhY3RzQ29udHJvbGxlcigpe30KICAgIAogICAgcHVibGljIHZvaWQgY29weUNvbnRhe1smKiZdfWN0cygpewogICAgICAgIGNvbkxpc3QgPSBuZXcgTGlzdCZsdDtDb250YWN0Jmd0OygpOwogICAgICAgIHRyeXsKICAgICAgICAgICB7WyYqJl19IGZvcihDb250YWN0IGNvbiA6W3NlbGVjdCBsYXN0bmFtZSxlbWFpbCxwaG9uZSBmcm9tIGNvbnRhY3Qgd2hlcmUgQWNjb3VudElkIHtbJiomXX09OmFjYzFJZF0pewogICAgICAgICAgICAgICAgQ29udGFjdCBjb250b0FkZCA9IG5ldyBDb250YWN0KAogICAgICAgICAgICAgICAge1smKiZdfQlMYXN0TmFtZSA9IGNvbi5MYXN0TmFtZSwKICAgICAgICAgICAgICAgICAgICBBY2NvdW50SWQgPSBhY2MySWQsCiAgICAgICAgICB7WyYqJl19ICAgICAgICAgIEVtYWlsID0gY29uLkVtYWlsLAogICAgICAgICAgICAgICAgICAgIFBob25lID0gY29uLnBob25lCiAgICAgICAgIHtbJiomXX0gICAgICAgKTsKICAgICAgICAgICAgICAgIGNvbkxpc3QuYWRkKGNvbnRvQWRkKTsKICAgICAgICAgICAgfQogICAgICAgICAgICBpe1smKiZdfW5zZXJ0IGNvbkxpc3Q7CiAgICAgICAgICAgIEFwZXhQYWdlcy5hZGRtZXNzYWdlKG5ldyBBcGV4UGFnZXMubWVzc2FnZShBcGV4UGF7WyYqJl19Z2VzLnNldmVyaXR5LkNPTkZJUk0sXFwmIzAzOTtDb250YWN0cyBDb3BpZWQgU3VjY2Vzc2Z1bGx5XFwmIzAzOTspKTsKICAgICAgICB9e1smKiZdfWNhdGNoKEV4Y2VwdGlvbiBlKXsKICAgICAgICAgICAgIEFwZXhQYWdlcy5hZGRtZXNzYWdlKG5ldyBBcGV4UGFnZXMubWVzc2FnZSh7WyYqJl19QXBleFBhZ2VzLnNldmVyaXR5LkVycm9yLGUuZ2V0TWVzc2FnZSgpKSk7CiAgICAgICAgfQogICAgfQp9XCI7e1smKiZdfQ==[[/code]]
    • This reply was modified 5 years, 4 months ago by  Shubham.
    • This reply was modified 5 years, 4 months ago by  Shubham.
  • Shubham

    Member
    July 19, 2016 at 8:10 am

    Hi Tanu,

    Yes you can create visual force component in Salesforce and you can use it in different visual force pages. Below is a simple visual force component example for your understanding.

    First create a visualforce component. Go to Setup > Develop > Visualforce Components > Click New. Enter the name of your component. In our case component name is 'MyComponent' .

    VF component

    `



    `

    VF page

    `

    `

     

  • Shubham

    Member
    June 14, 2016 at 7:38 am

    Hi Ajit,

    1) Yes you are correct, System method 'runas' enables you to write test methods that change the user context to the current user or a new user so that user record sharing is enforced. Here is a simple example in which a new user is created and the test class will run as that user.

    `@isTest
    private class TestClassName {
    public static testMethod void testMethodName() {

    // This code will runs as the system user
    Profile p = [SELECT Id FROM Profile WHERE Name='Standard User'];
    User testUser = new user();
    testUser.LastName = 'Test Code';
    testUser.Email = '[email protected]';
    testUser.Alias = 'Tcode';
    testUser.Username = '[email protected]';
    testUser.CommunityNickname = 'test12';
    testUser.LocaleSidKey = 'en_US';
    testUser.TimeZoneSidKey = 'GMT';
    testUser.ProfileID = p.Id;
    testUser.LanguageLocaleKey = 'en_US';
    testUser.EmailEncodingKey = 'UTF-8';
    insert testUser;

    System.runAs(testUser) {
    // The following code runs as user 'testUser'
    System.debug('Current User: ' + UserInfo.getUserName());
    System.debug('Current Profile: ' + UserInfo.getProfileId());
    }
    }
    }
    `
    2. test.startTest() and test.stopTest() are used to mark the points from where your test actually begins & ends in your test class. So that before calling 'test.startTest()' you can set up data,initialize variables,everything you need to run your test. Any code executes after 'test.startTest()' will be assigned with new set of governor limits.

    • This reply was modified 5 years, 5 months ago by  Shubham.
  • Shubham

    Member
    June 9, 2016 at 3:19 pm

    With apex we cannot send a message directly to a phone . For this functionality you have to use a third party SMS API to send message. You can use textlocal.in API but it is not free you get only 10 free sms for testing purpose.

    Here is the link :  https://textlocal.in/simple-developer-sms-api

Viewing 1 - 25 of 40 posts