• Rakesh Kumar Saini
  • NEWBIE
  • 40 Points
  • Member since 2014


  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 8
    Replies
I am attempting to create a trigger that will update certain fields if the value in a multipicklist is present.

Rather than have 20 If statements to check if the value is in it, I want to be able to something like 

IF taskListValue is in picklistValue
THEN fieldToUpdate = fieldListValue.indexof( taskListValue.indexof( picklistValue )

It would then say something like ...

thisRecord.fieldToUpdate = TRUE

updateObject.add(thisRecord);

What I currently have is
 
//-- Some Varaibles to start with

STRING strRelated = thisTask.Campaign_Related__c;
STRING[] strRelated_split = strRelated.split(';');

LIST<STRING> lstOfTasks = NEW LIST<STRING>(); //-- Stores the values that can be in the multipicklist thisTask.Campaign_Related__c
LIST<STRING> lstOfFields = NEW LIST<STRING>(); //-- Stores the field names that we want to update if the values is passed. These are in the same sequence so getting the index of one will refer to the index of the other.

//-- Add some values to our lists
lstOfTasks.add('EDU - Business Insurance Session');
lstOfFields.add('Business_Insurance_Session_Completed__c');
lstOfTasks.add('EDU - CBA/CFP Branch Training Session');
lstOfFields.add('CBA_CFP_Branch_Training_Session_Complete__c');
lstOfTasks.add('EDU - Client Seminars');
lstOfFields.add('Client_Seminars_Completed__c');


FOR(intCount = 0; intCount < strRelated_split.size() ; intCount++)
{
    IF( strReleated_split[intCount] is in lstOfTasks)
    {
        intX = lstOfTasks.indexOf( strReleated_split[intCount] );
        theField = lstOfFields[intX]
        thisAMP.thisField = TRUE;
    }
}
Any help would be appreciated.
 
Hi there,
i am trying to add the Live Agent to my Community for several days now...

FIrst i tried to implement the Chat Button to my Community site by trying this: https://help.salesforce.com/articleView?id=000247349&type=1
Although every ID was implemented correctly, this button just always shows "Chat Unvailable".

So i tried to make a button on my own via a Visualforce Page and then i wanted to add it to my community. It works fine when i just save it as an HTML file and open it in the browser, but when i want to implement it via Visualforce into my Community it just shows the picture of the Offline/Online status, but i am not able to click it.

Any idea what is wrong there? I also tried it with the "Automated Inivation" Code instead of the Chat Button Code, but still doesnt work :(

Thank you for your help!


This is my Code: 
 
<apex:page >
<img id="liveagent_button_online_5730Y000000Cdn1" style="display: none; border: 0px none; cursor: pointer" onclick="liveagent.startChat('5730Y000000Cdn1')" src="https://esaas-developer-edition.eu11.force.com/b2c/resource/1493552309000/Online" /><img id="liveagent_button_offline_5730Y000000Cdn1" style="display: none; border: 0px none; " src="https://esaas-developer-edition.eu11.force.com/b2c/resource/1493552255000/Offline" />
<script type="text/javascript">
if (!window._laq) { window._laq = []; }
window._laq.push(function(){liveagent.showWhenOnline('5730Y000000Cdn1', document.getElementById('liveagent_button_online_5730Y000000Cdn1'));
liveagent.showWhenOffline('5730Y000000Cdn1', document.getElementById('liveagent_button_offline_5730Y000000Cdn1'));
});</script>



<script type='text/javascript' src='https://c.la1-c2-par.salesforceliveagent.com/content/g/js/39.0/deployment.js'></script>
<script type='text/javascript'>
liveagent.init('https://d.la1-c2-par.salesforceliveagent.com/chat', '5720Y000000CdFk', '00D0Y000001etN6');
</script>
</apex:page>
Hi all, I have developed an apex class and trigger to automatically deploy echoSign agreements based on a criteria that is met in the trigger. However, it appears a web service is being called when I design the class, and implement a test class. 

The goal with this trigger is to automate the sending of agreement templates from echoSign to the contact who will sign the agreement. 
With the @future callout the trigger creates the object but does not run. However without it, it does. Needless to say without the @future callout the test class fails with the Methods defined as TestMetod do not support web service.

Are there any steps I should take.

Here's the class
public class AutoSendAdobeSign { 
    
    public static void sendAgreement(Id temId, Id mteId) { 
    try {
           System.debug('Calling AgreementTemplateService.load: ' + temid + ' - ' + mteid); 
           echosign_dev1.AgreementTemplateService.load( temid , mteid );        
    } catch (Exception E) { System.debug('Exception: ' + e.getStackTraceString());}       
    }
}

The Trigger with the specified crtieria to run
 
trigger SendMTEviaAdobeSign on Member_Term_Evaluation__c (after update) {
        //This Class Automatically Sends an Adobe Sign Agreement for the Member_Term_Evaluation Custom Object


        //For the PY17 Member Term Evaluation, this variable can be updated according to Program Year
    String templateId; 
           templateId = [SELECT Id FROM echosign_dev1__Agreement_Template__c WHERE Name = 'Evaluation' ].Id;
 {
    //Only send when the Signed By Supervisor field is checked off
            for(Member_Term_Evaluation__c mte: Trigger.new) {
                if(mte.Id != NULL && mte.Date_of_Review__c != NULL && mte.Signed_by_Supervisor__c != Trigger.oldMap.get(mte.Id).Signed_by_Supervisor__c ){
                        String masterId = mte.Id;
                        AutoSendAdobeSign.sendAgreement(templateId, masterId);
                        system.debug(mte.Service_Member__r.FirstName + ' and ' + mte.Lead_Supervisor__r.LastName + ' will be getting their member term evaluation on ' + mte.Date_of_Review__c.format() + ' .');
                }
                }
    }
}



Here is my Test Class
@isTest
private class SendMTEviaAdobeSignTest {

static testMethod void insertNewmasterId() {
     Test.startTest();

RecordType servicememberRT = [SELECT Id from RecordType WHERE sObjectType = 'Contact' AND Name = 'Service Member' LIMIT 1];

    Echosign_dev1__SIGN_Merge_Mapping__c adobemm = new Echosign_dev1__SIGN_Merge_Mapping__c();
     adobemm.Name                                = 'masterId';
     adobemm.echosign_dev1__Default__c           = FALSE;
     insert adobemm;                 

    Echosign_dev1__Agreement_Template__c adobeat = new Echosign_dev1__Agreement_Template__c();
     adobeat.Name                                   = 'PY17 Service Member Term Evaluation';
     adobeat.Echosign_dev1__Auto_Send__c            = TRUE;
     adobeat.Echosign_dev1__Name__c                 = 'Adobe Sign Agreement';
     adobeat.Echosign_dev1__Signature_Type__c       = 'e-Signature';
     adobeat.Echosign_dev1__Language__c             = 'English (United States)';
     adobeat.Echosign_dev1__Merge_Mapping__c        = adobemm.id;
     insert adobeat;

    Account servicesite = new Account();
     servicesite.Name                           = 'Cheesy Does It';
     servicesite.Type                           = 'Education';
     servicesite.BillingStreet                  = '704 NE Sample Street';
     servicesite.BillingCity                    = 'Portland';
     servicesite.BillingState                   = 'Oregon';
     servicesite.BillingPostalCode              = '97212';
     servicesite.Organization_Sub_type__c       = 'School';
     servicesite.Service_Site_Status__c         = 'Active';
     servicesite.School_Status__c               = 'Active';
     insert servicesite;

    Contact servicemember = new Contact();
     servicemember.FirstName                    = 'Macaroni';
     servicemember.LastName                     = 'Cheese';
     servicemember.Npe01__HomeEmail__c          = 'macandcheese@aolol.com';
     servicemember.RecordTypeId                 =  servicememberRT.Id;
     insert servicemember;

    Contact leadsupervisor = new Contact();
     leadsupervisor.FirstName                   = 'Head';
     leadsupervisor.LastName                    = 'Cheese';
     leadsupervisor.Npe01__HomeEmail__c         = 'saycheese@aolol.com';
     leadsupervisor.Service_Site_Supervisor2__c = 'Active, Primary';
     insert leadsupervisor;


    Member_Term__c mt = new Member_Term__c();
     mt.Service_Member__c                       = servicemember.Id;
     mt.Service_Site__c                         = servicesite.Id;
     mt.Lead_Supervisor__c                      = leadsupervisor.Id;
     mt.Date_Contract_Signed__c                 = date.today();
     mt.Date_Enrolled__c                        = date.today();
     mt.School_1__c                             = 'Cheesy Does It';
     mt.Healthy_Progress_Report_Area_1__c       = 'B - Field trips, farmer and chef visits';
     mt.Healthy_Progress_Report_Goal_1__c       = 'Win a Million Bucks';
     mt.Goal_1_Resources_Needed__c              = 'A Million Bucks';
     insert mt;

    Member_Term_Evaluation__c mte = new Member_Term_Evaluation__c();
     mte.Member_Term__c                         = mt.Id;
     mte.Service_Member__c                      = servicemember.Id;
     mte.Lead_Supervisor__c                     = leadsupervisor.Id;
     mte.Date_of_Review__c                      = date.today();
     mte.Signed_by_Service_Member__c            = TRUE;
     mte.Signed_by_Supervisor__c                = FALSE;
     insert mte;


     mte.Signed_by_Supervisor__c                = TRUE;
     update mte;
     
    echosign_dev1__SIGN_Agreement__c e = new echosign_dev1__SIGN_Agreement__c();
     e.Name                                    = 'Service Member Term Evaluation';
     e.ECHOSIGN_DEV1__AGREEMENTLOCALE__C       = 'English (United States)';
     e.ECHOSIGN_DEV1__SIGNATURETYPE__C           = 'e-Signature';
     e.ECHOSIGN_DEV1__STATUS__C                  = 'Out for Signature';
     insert e; 
    
     Test.stopTest();

}
}



 
Hello.I am new using SFDC and i have a problem now.

I want to select some data that was created 14 days ago. so i wrote soql like this:
Select Id, CreatedDate FROM ***** WHERE CreatedDate < Last_N_DAYs:14 order by CreatedDate DESC
for example today is 19th so i want to get the date before 5th, but the latest date i get is 2016-08-03T23:34:01.000+0000
FYI i am in UTC 9 time zone. but it is still not right considering the time zone thing.  

I appriciate if someone can tell me what is wrong with it. thanks.

I just created a visualforce page in sandbox for a custom object and have successfully deployed it onto production together with its controller but have trouble displaying the page for partner community users in production (whereas it displays properly in sanbox for partner community users).

All settings are the same on production and sandbox.

What I additionally did:

- grant access in the visualforcepage/securty by adding the systme admin profile to the page after deployment

Any help is much appreciated!

Hi,
I am already have right code to get goole map from the custom object when street, surbub, city and country all fill in.
So, my question is:
if this custom object have another field which is called geolocation (latitude, longtitude).

How can I get map from geolocation first, if geolocation is empty or have errors, then run my code(showing below) to get map from those field( street, surbub, city and country)

could you give me another part of code which is getting map from geolocation:)

Thanks,
<apex:page standardController="Location__c">

<head>

<script type="text/javascript" src="https://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> 
<script type="text/javascript"> 

$(document).ready(function() {

  var myOptions = {
    zoom: 15,
    mapTypeId: google.maps.MapTypeId.ROADMAP,
    mapTypeControl: false
  }

  var map;
  var marker;

  var geocoder = new google.maps.Geocoder();
  var address = "{!Location__c.Street__c} {!Location__c.city__c} {!Location__c.Suburb__c} {!Location__c.Country__c}";
  var infowindow = new google.maps.InfoWindow({
  content: "<b>{!Location__c.Name}</b><br>" + address + " "
  });

  geocoder.geocode( { address: address}, function(results, status) {
    if (status == google.maps.GeocoderStatus.OK && results.length) {
      if (status != google.maps.GeocoderStatus.ZERO_RESULTS) {

        //create map
        map = new google.maps.Map(document.getElementById("map"), myOptions);

        //center map
        map.setCenter(results[0].geometry.location);

        //create marker
        marker = new google.maps.Marker({
            position: results[0].geometry.location,
            map: map,
            title: "{Location__c.Name__c}"
        });

        //add listeners
        google.maps.event.addListener(marker, 'click', function() {
          infowindow.open(map,marker);
        });
        google.maps.event.addListener(infowindow, 'closeclick', function() {
          map.setCenter(marker.getPosition()); 
        });

      }

    } else {
      $('#map').css({'height' : '15px'});
      $('#map').html("Oops! address could not be found, please make sure the address is correct.");
      resizeIframe();
    }
  });

  function resizeIframe() {
    var me = window.name;
    if (me) {
      var iframes = parent.document.getElementsByName(me);
      if (iframes && iframes.length == 1) {
        height = document.body.offsetHeight;
        iframes[0].style.height = height + "px";
      }
    }
  }

});
</script>

<style>
#map {
  font-family: Arial;
  font-size:12px;
  line-height:normal !important;
  height:250px;
  //min-width:300px;
  background:transparent;
}
</style>

</head>

<body>
<div id="map"></div> 
</body>   
</apex:page>

 
I am attempting to create a trigger that will update certain fields if the value in a multipicklist is present.

Rather than have 20 If statements to check if the value is in it, I want to be able to something like 

IF taskListValue is in picklistValue
THEN fieldToUpdate = fieldListValue.indexof( taskListValue.indexof( picklistValue )

It would then say something like ...

thisRecord.fieldToUpdate = TRUE

updateObject.add(thisRecord);

What I currently have is
 
//-- Some Varaibles to start with

STRING strRelated = thisTask.Campaign_Related__c;
STRING[] strRelated_split = strRelated.split(';');

LIST<STRING> lstOfTasks = NEW LIST<STRING>(); //-- Stores the values that can be in the multipicklist thisTask.Campaign_Related__c
LIST<STRING> lstOfFields = NEW LIST<STRING>(); //-- Stores the field names that we want to update if the values is passed. These are in the same sequence so getting the index of one will refer to the index of the other.

//-- Add some values to our lists
lstOfTasks.add('EDU - Business Insurance Session');
lstOfFields.add('Business_Insurance_Session_Completed__c');
lstOfTasks.add('EDU - CBA/CFP Branch Training Session');
lstOfFields.add('CBA_CFP_Branch_Training_Session_Complete__c');
lstOfTasks.add('EDU - Client Seminars');
lstOfFields.add('Client_Seminars_Completed__c');


FOR(intCount = 0; intCount < strRelated_split.size() ; intCount++)
{
    IF( strReleated_split[intCount] is in lstOfTasks)
    {
        intX = lstOfTasks.indexOf( strReleated_split[intCount] );
        theField = lstOfFields[intX]
        thisAMP.thisField = TRUE;
    }
}
Any help would be appreciated.
 
Hi, 
I am trying to finish Handle Actions with Controllers section iin Lightning components trailhead. My code works as asked in the challenge.
But I still get this error:
Challenge Not yet complete... here's what's wrong: 
The campingListItem Lightning Component doesn't contain a button or its attributes are not set correctly when clicked.


<aura:component >
    <aura:attribute name='item' type='Camping_Item__c' required='true' default="{Name:'Torch', Price__c: 10, Quantity__c: 1, Packed__c: false}"></aura:attribute>
    <aura:attribute name='disabled' type='Boolean'></aura:attribute>
    
    <ui:outputText value='{!v.item.Name}'></ui:outputText>
    <ui:outputCheckbox value="{!v.item.Packed__c}"></ui:outputCheckbox>
    <ui:outputCurrency value="{!v.item.Price__c}"></ui:outputCurrency>
    <ui:outputNumber value="{!v.item.Quantity__c}"></ui:outputNumber>
    
    <ui:button press='{!c.packItem}' disabled='{!v.disabled}' label='Packed!'></ui:button>
</aura:component>

({
    packItem : function(component, event, helper) {
        var item = component.get('v.item');
        component.set('v.item.Packed__c', true);
        var btnPackItem = event.getSource();
        btnPackItem.set('v.disabled', true);
    }
})