• Moggy
  • NEWBIE
  • 128 Points
  • Member since 2012

  • Chatter
    Feed
  • 3
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 6
    Questions
  • 73
    Replies

Hey all,

is there anybody who could post a sample code for a lightning component and controller to integrate with WorldPay's 3ds secure payment gateway if that is possible at all.

I have read all about their API's but it is all based on standard web not Salesforce.

For Salesforce there is an appExchange pack but that requires the commerce cloud , so this is not applicable 

The Chargent package is also not applicable as it does not support Wordlpay UK only US

So I wonder , there must be someone out there who did this integration and might like to share some insight ( code sample) please

I have a payment form for the inputs, and works well with the standard https://api.worldpay.com/v1/tokens and orders but this is deemd not to be 3Ds

Any help wuld be appreciated

Hello,

As I understand, Process Builder runs under the system mode and if the running user doesn't have permission, the user still able to perform the operation due to system mode. I tried to create a chatter post on a case object using Process Builder, by running as a user who has implicit permission on the case. When I looked at the log, it still runs under the user mode (I can see as Current User) and got the following error while creating a chatter post

Error Occurred: You don't have permission to do this. 
________________________________________
________________________________________
Salesforce Error ID: 157378386-59592 (1177104658)

Thanks,
Hi all, I am trying to create a trigger that will autopopulate my lookup field when a value is selected from the picklist however I am getting these errors and I don't know why.

My lookup field is to contact (which is filtered).

User-added image

We all know how to use an image inside a formula field

(IMAGE(URL, Alternate Text, H,W)

In Lightning we can use <img src=..... onError....

My question is prteey simple:

is there any way to figure out (system) not by viewing if the formula is actually displaying an image.

Or differently phrased is there a way to find out if the image url will return nothing and therefoe display the alternate text / show an on error image which might be there or not, hence my question 

Sure we use the formula to display images we know about but what if the image is sitting in the cloud and someone deleted it

a formula or img src tag does not do a http callout, so how to find out if its a shown image in that field or not??

Hi Experts,

i have two Picklist .Two pick list are TO and casereason.
whenever user a selected a vlaue with (Com Apg )from To Picklist then (PO Bokeed) with value dispaly in Casereason picklist .
How to we can achive in visualforce page.below i have attached my screen shatUser-added image

Thanks,
VIswa.
Our users are receiving the following error when attempting to convert a lead, and SF support has told us it is due to a managed package yet could not identify which. Does anyone have any insight into what package may be causing this, and how to resolve? 

'Error: System.DmlException: Insert failed. First exception on row 0; first error: FIELD_INTEGRITY_EXCEPTION, null: [] Class.leadconvert.BulkLeadConvert.handleRegularContactInserts: line 326, column 1 ' 

Any help is much appreciated.

Best,
Julian
HI,

I am trying to check the chkbox on oppty if their are atleast one child record (Lookup relationship to custom object) , If all records attached to Oppty are deleted, this box should be unchecked.

Any suggestions?
I am working on trying to have a field be requiered on a VF page while not being so in Salesforce. There are flows and process buidler applications that are preventing this so here is what I have:

<td><apex:inputfield value="{!ClientProfile__c.Primary_Parts_Supplier__c}" required="true" id="PrimaryPartsSupplier" /></td>

It does show as requiered but still allow me to save the page w/o a value.

Once I can get this to work, is there a way to set it so that one of 3 fields need to be completed prirot be being saves?

Thanks
Hi guys I will appreciate help with this. We use email to case alot in my company. We have a queue A with many cases in it and we have another different queue B.

I want people who work in queue A to be able to send n email from a case in queue A and therefore generate a new case in queue B. We have the email thread on our templates and email subject at the moment and that prevents this from happening.

It will be great if anyone can help.
I have to write test class for this apex code:

public static void CreaEventoCorrispondente() {


        if (trigger.isInsert) {

            Map<Integer, Event> EventstoUpsert1 = new Map<Integer, Event> ();
            Map<Integer, Event> EventstoUpsert2 = new Map<Integer, Event> ();
            List<Schema.PicklistEntry> ple = Edizione__c.Lead_Tutor__c.getDescribe().getPicklistValues();
            List<String> cognomiTutor = new List<String> ();
            for (Schema.PicklistEntry p : ple) {
                cognomiTutor.add(p.getLabel());
            }
            Map<String, Id> CognomiIds = new Map<String, Id> ();
            for (User u :[SELECT Id, LastName FROM User WHERE LastName IN :cognomiTutor]) {
                CognomiIds.put(u.LastName, u.Id);
            }

            integer pos = 0;

        
            for (Edizione__c e : (List<Edizione__c>) trigger.new) {

                if (e.Lead_Tutor__c != NULL && CognomiIds.keySet().contains(e.Lead_Tutor__c)) {
                    Event newEvent1 = new Event(isAllDayEvent = TRUE, Location=e.Sede__c, Subject = e.Name, StartDateTime = (DateTime.newInstance(e.Data_inizio__c , (DateTime.newInstance(e.Data_inizio__c, Time.newInstance(0,0,0,0))).timeGMT())), EndDateTime = (DateTime.newInstance(e.Data_fine__c, (DateTime.newInstance(e.Data_fine__c, Time.newInstance(0,0,0,0))).timeGMT())), OwnerId = CognomiIds.get(e.Lead_Tutor__c));
                    EventstoUpsert1.put(pos, newEvent1);
                }
                if (e.Lead_Tutor__c != NULL && CognomiIds.keySet().contains(e.Second_Tutor__c)) {
                    Event newEvent2 = new Event(isAllDayEvent = TRUE, Location=e.Sede__c, Subject = e.Name, StartDateTime = (DateTime.newInstance(e.Data_inizio__c, (DateTime.newInstance(e.Data_inizio__c, Time.newInstance(0,0,0,0))).timeGMT())), EndDateTime = (DateTime.newInstance(e.Data_fine__c, (DateTime.newInstance(e.Data_fine__c, Time.newInstance(0,0,0,0))).timeGMT())), OwnerId = CognomiIds.get(e.Second_Tutor__c));
                    EventstoUpsert2.put(pos, newEvent2);
                }
                pos++;
            }
            if (!EventstoUpsert1.isEmpty()) {
                insert EventstoUpsert1.values();
                for (Integer i : EventstoUpsert1.keySet()) {
                    Edizione__c ed = ((Edizione__c) trigger.new[i]);
                    ed.IdEventoLeadTutor__c = EventstoUpsert1.get(i).Id;
                }

            }
            if (!EventstoUpsert2.isEmpty()) {
                insert EventstoUpsert2.values();
                for (Integer i : EventstoUpsert2.keySet()) {
                    Edizione__c ed = ((Edizione__c) trigger.new[i]);
                    ed.IdEventoSecondTutor__c = EventstoUpsert2.get(i).Id;
                }

            }

        } else if (trigger.isUpdate) {

            Map<Id, Event> EventstoUpsert1 = new Map<Id, Event> ();
            Map<Id, Event> EventstoUpsert2 = new Map<Id, Event> ();
            List<Schema.PicklistEntry> ple = Edizione__c.Lead_Tutor__c.getDescribe().getPicklistValues();
            List<String> cognomiTutor = new List<String> ();
            List<Id> EventstoDelete = new List<Id>();
            for (Schema.PicklistEntry p : ple) {
                cognomiTutor.add(p.getLabel());
            }
            Map<String, Id> CognomiIds = new Map<String, Id> ();
            for (User u :[SELECT Id, LastName FROM User WHERE LastName IN :cognomiTutor]) {
                CognomiIds.put(u.LastName, u.Id);
            }

            for (Edizione__c e : (List<Edizione__c>) trigger.new) {
                if (e.Lead_Tutor__c != ((Edizione__c) trigger.oldMap.get(e.Id)).Lead_Tutor__c) {
                    if (((Edizione__c) trigger.oldMap.get(e.Id)).Lead_Tutor__c == NULL){
                        Event ev = new Event();
                        ev = new Event(isAllDayEvent = TRUE, Subject = e.Name, Location=e.Sede__c, StartDateTime = (DateTime.newInstance(e.Data_inizio__c, (DateTime.newInstance(e.Data_inizio__c, Time.newInstance(0,0,0,0))).timeGMT())), EndDateTime = (DateTime.newInstance(e.Data_fine__c, (DateTime.newInstance(e.Data_fine__c, Time.newInstance(0,0,0,0))).timeGMT())), OwnerId = CognomiIds.get(e.Lead_Tutor__c));
                        EventstoUpsert1.put(e.Id, ev);
                    } else if (e.Lead_tutor__c == NULL) {
                        EventstoDelete.add(e.IdEventoLeadTutor__c);
                        e.IdEventoLeadTutor__c = NULL;
                    } else {
                        if (((Edizione__c) trigger.oldMap.get(e.Id)).IdEventoLeadTutor__c != NULL) {
                            EventstoUpsert1.put(e.Id, new Event(Id = ((Edizione__c) trigger.oldMap.get(e.Id)).IdEventoLeadTutor__c, OwnerId = CognomiIds.get(e.Lead_Tutor__c)));
                        }
                    }
                }
                if (e.Second_Tutor__c != ((Edizione__c) trigger.oldMap.get(e.Id)).Second_Tutor__c) {
                    if (((Edizione__c) trigger.oldMap.get(e.Id)).Second_Tutor__c == NULL){
                        Event ev = new Event();
                        ev = new Event(isAllDayEvent = TRUE, Subject = e.Name, Location=e.Sede__c, StartDateTime = (DateTime.newInstance(e.Data_inizio__c, (DateTime.newInstance(e.Data_inizio__c, Time.newInstance(0,0,0,0))).timeGMT())), EndDateTime = (DateTime.newInstance(e.Data_fine__c, (DateTime.newInstance(e.Data_fine__c, Time.newInstance(0,0,0,0))).timeGMT())), OwnerId = CognomiIds.get(e.Second_Tutor__c));
                        EventstoUpsert2.put(e.Id, ev);
                    } else if (e.Second_tutor__c == NULL) {
                        EventstoDelete.add(e.IdEventoSecondTutor__c);
                        e.IdEventoSecondTutor__c = NULL;
                    } else {
                        if (((Edizione__c) trigger.oldMap.get(e.Id)).IdEventoSecondTutor__c != NULL) {
                            EventstoUpsert2.put(e.Id, new Event(Id = ((Edizione__c) trigger.oldMap.get(e.Id)).IdEventoSecondTutor__c, OwnerId =  CognomiIds.get(e.Second_Tutor__c)));
                        }
                    }
                }
            }

            if (!EventstoUpsert1.isEmpty()) {
                upsert EventstoUpsert1.values();
                for (Id i : EventstoUpsert1.keySet()) {
                    Edizione__c ed = ((Edizione__c) trigger.newMap.get(i));
                    ed.IdEventoSecondTutor__c = EventstoUpsert1.get(i).Id;
                }
            }
            if (!EventstoUpsert2.isEmpty()) {
                upsert EventstoUpsert2.values();
                for (Id i : EventstoUpsert2.keySet()) {
                    Edizione__c ed = ((Edizione__c) trigger.newMap.get(i));
                    ed.IdEventoSecondTutor__c = EventstoUpsert2.get(i).Id;
                }
            }
            if (!EventstoDelete.isEmpty()){
                List<Event> ETDL = new List<Event>();
                for (Id i : EventstoDelete){
                    ETDL.add(new Event(Id = i));
                }
                delete ETDL;
            }

        }

    }

This class retrive an apex trigger :

trigger Trigger_Edizione on Edizione__c (before update, before insert, after update, before delete) {
if (trigger.isBefore){
        if (!trigger.isDelete){
            EdizioneHelper.CreaEventoCorrispondente();
        } else {
            EdizioneHelper.CancellaEventoCorrispondente();
        }
    } 




The test class that I have writed is :

static testMethod void TestCreaEventoCorrispondente() {
     
     Map<Integer, Event> Events1 = new Map<Integer, Event> ();
      Map<Integer, Event> Events2 = new Map<Integer, Event> ();
     List <Schema.PicklistEntry> l_picklist = new List <Schema.PicklistEntry>();
     List <Id>l_Ids= new List <Id>();
     Map<String,Id> S_Ids = new Map <String,Id> ();
       
List <Edizione__c> l_ed= new List <Edizione__c>();
     Edizione__c edizione = new Edizione__c(Data_inizio__c=date.valueof('2016-09-07'),Data_fine__c=date.valueof('2016-09-07'),motivo_stato__c='edizione confermata', Codice_piattaforma__c='edizione',Sede__c='Milano',Name='ciccio',Data_Invio_al_Sito__c=date.valueof('2016-09-15'),Lead_Tutor__c='Colonna');
        insert edizione;
     l_ed.add(edizione);
   
       
        List <Event> l_ev = new List <Event>(); 
        Event ev = new Event (Location=edizione.Sede__c,Subject=edizione.name, IsAllDayEvent=false, StartDateTime = datetime.newInstance(2014, 11, 13, 16, 30, 0), EndDateTime = datetime.newInstance(2014, 11, 13, 18, 30, 0));
         l_ev.add(ev); 
        insert ev;
        
      
         User us = new User (Username='d.pippo@bridgepartners.it.dev',LastName='Pugliese',FirstName='Domenico', Email='d.pugliese@bridgepartners.it', Alias='dpugl', CommunityNickname='d.pippo', TimeZoneSidKey='Europe/Rome', LocaleSidKey='it_IT', EmailEncodingKey='ISO-8859-1', ProfileId='00e58000000ZU0WAAW', LanguageLocaleKey='it');
        insert us;
         update us;
    
     EdizioneHelper.CreaEventoCorrispondente();
     
     update ev;
     EdizioneHelper.CreaEventoCorrispondente();
     
     delete ev;
     EdizioneHelper.CreaEventoCorrispondente();
     
     delete l_ev;
     EdizioneHelper.CreaEventoCorrispondente();
   
         
     ev.IsAllDayEvent=true;
     update ev;
     EdizioneHelper.CreaEventoCorrispondente();
     
     edizione.Second_Tutor__c='Fioretti';
     update edizione;
     EdizioneHelper.CreaEventoCorrispondente();
     
 }
   

The result of run test  is :


System.NullPointerException: Attempt to de-reference a null object, when I write in the test class
EdizioneHelper.CreaEventoCorrispondente(); 
and when I write   if (trigger.isInsert)  in the apex class


 
Hi guys,

Can anyone help me with a test class for the below trigger?

trigger defaultEntitlement on Case (Before Insert, Before Update) {
   /*
   If the Entitlement Name is not set then, check to see if the Contact on the Case has an active Entitlement
    and select the first one.  If not then check to see if the Account on the Case has an active Entitlement.
   */
   List<Id> contactIds = new List<Id>();
   List<Id> acctIds = new List<Id>();
   for (Case c: Trigger.new){
      if (c.EntitlementId == null && c.ContactId!= null && c.AccountId!= null){
         contactIds.add(c.ContactId);
         acctIds.add(c.AccountId);
      }
   }
   if(contactIds.isEmpty()==false || acctIds.isEmpty()==false){
      /* Added check for active entitlement */
      List <EntitlementContact> entlContacts = [Select e.EntitlementId,e.ContactId,e.Entitlement.AssetId From EntitlementContact e
                                                Where e.ContactId in:contactIds
                                                And e.Entitlement.EndDate >= Today And e.Entitlement.StartDate <= Today];
      if(entlContacts.isEmpty()==false){
         for(Case c: Trigger.new){
            if(c.EntitlementId == null && c.ContactId!= null){
               for(EntitlementContact ec:entlContacts){
                  if(ec.ContactId==c.ContactId){
                     c.EntitlementId = ec.EntitlementId;
                     if(c.AssetId==null && ec.Entitlement.AssetId!=null)
                        c.AssetId=ec.Entitlement.AssetId;
                     break;
                  }
               } // end for
            }
         } // end for
      } else{
         List <Entitlement> entls = [Select e.StartDate, e.Id, e.EndDate, e.AccountId, e.AssetId
                                     From Entitlement e
                                     Where e.AccountId in:acctIds And e.EndDate >= Today And e.StartDate <= Today];
         if(entls.isEmpty()==false){
            for(Case c: Trigger.new){
               if(c.EntitlementId == null && c.AccountId!= null){
                  for(Entitlement e:entls){
                     if(e.AccountId==c.AccountId){
                        c.EntitlementId = e.Id;
                        if(c.AssetId==null && e.AssetId!=null)
                           c.AssetId=e.AssetId;
                        break;
                     }
                  } // end for
               }
            } // end for
         }
      }
   } // end if(contactIds.isEmpty()==false)
}
Hi All,

  How can we give our own custom LastModifiedaDate  to records while inserting in test classes.

We have class which has a query

  
if (jobType == PROCESS_DEL_VIOC_FRANCHISE_RECORDS) {
            query = Database.getQueryLocator([SELECT Id FROM Lead  where RecordType.Name=:RecordTypeUtil.VIOC_Franchise_Web_lead and LastModifiedDate < LAST_N_YEARS:3]);
        }

While writing test class for this class, we are trying to create some test data. To meet above condition we have to give LastModifiedDate  which must be 3 years old. How can we write a test class in this situations.

Any help is really appreciated.

Thanks,
Naveen.
Getting visualforce page error as List has no rows for assignment to SObject.  An unexpected error has occurred. Your development organization has been notified.
Here is my page controller.

Controller-
public class MyFirstController {


    private final Account account;

    public MyFirstController () {

        account = [SELECT Id, Name, Site FROM Account

                   WHERE Id = :ApexPages.currentPage().getParameters().get('id')];

    }

 
    public Account getAccount() {

        return account;

    }

 
    public PageReference save() {

        update account;

        return null;

    }

}
 
Hi All,

I want to update the few fields of converted leads. So can you guys please help me and let me know how can update it. 

Thanks in advance

I was previously able to delete PermissionSetAssignment through the REST API. Now I am getting:

 

You can't assign or unassign this permission set because it's associated with a profile.

 

I would think that I was doing exactly that - deleting the assignment to dissociate the profile from the PermissionSet. Any pointers? 

 

thanks

yan at crowdcast dot com

Hi All,

 

I have requirement where I have to implement Cybersource payment gateway in Salesforce.com. I am trying to use Cybersource Hosted Order Page approach to implement this functionality.

 

Cybersource has provided me some sample JSP pages which I can use in any java based web application and implement the payment gateway within that application and I am able to do that.

 

Now I have to simulate the same functionality in Salesforce.com using Visualforce and Apex. I am able to simulate most of the code in Apex but got stuck while simulating Message Authentication code and secret key. Below is the code written in java which I need to simulate in Apex.

 

 

  public String getPublicDigest(String customValues) throws Exception{
    String pub =  "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC2L8taoXQvBV5xddZp58JE2i3rQauaBe1U1lEQCIYNYlIQSt4J6++F6NBgmCx1vnSCX2s4O0FI3S5b/No7QTfKkO19ofJVYBB6hdlcPStHsnYLV9mDmHuFfiR8Ebk3dUWYVCQX+eyZj99WQmYiTPIEZSAuB54jTMRQwyAE5GsVwIDAQAB";    
    BASE64Encoder encoder = new BASE64Encoder();
    Mac sha1Mac = Mac.getInstance("HmacSHA1");
    SecretKeySpec publicKeySpec = new SecretKeySpec(pub.getBytes(), "HmacSHA1");
    sha1Mac.init(publicKeySpec);
    byte[] publicBytes = sha1Mac.doFinal(customValues.getBytes());
    String publicDigest = encoder.encodeBuffer(publicBytes);
    return publicDigest.replaceAll("\n", "");
  }

Here is the code which I simulated in Apex but the key generated is still invalid.

 

 

    public String getPublicDigest(String customValues){
	String secretKey = 'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC2L8taoXQvBV5xddZp58JE2i3rQauaBe1U1lEQCIYNYlIQSt4J6++F6NBgmCx1vnSCX2s4O0FI3S5b/No7QTfKkO19ofJVYBB6hdlcPStHsnYLV9mDmHuFfiR8Ebk3dUWYVCQX+eyZj99WQmYiTPIEZSAuB54jTMRQwyAE5GsVwIDAQAB';
        //Blob blobDigest = Crypto.generateDigest('hmacSHA1', Blob.valueOf(pub));
        Blob sha1Mac = Crypto.generateMac('hmacSHA1', Blob.valueOf(customValues), EncodingUtil.base64Decode(secretKey));
        String publicDigest = Encodingutil.convertToHex(sha1Mac);
        return publicDigest;
    }

 

 

Any help is appreciated.

 

 

I was told that when I signed up as a developer, I would have access to a demo database.

I was told that I would use my logon user name and password to logon to Sales Force.

 

I copied the VB code from the PDF and appears to work, but I am getting an error:

 

"Invalid username, password, security token; or user locked out."

 

I assume the User name and/or password is not the correct one to use.

 

I did use WireShark to confirm Internet traffic was occuring when trying to login.

 

Any help would be appreciated,

Ira