• Frances Day 9
  • NEWBIE
  • 10 Points
  • Member since 2016

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

We recently have had a need to convert from the old slack webhook methodology to a new method of connecting Slack and Salesforce. 

We have successfully setup the webhook and messages are flowing to the designated channel, but this is not emulating the behavior we had in the past.

Previously we had used the @Invocable method to call from Process Builder or Flow the channel that we wanted to post the message to, and this allowed us to distribute the incoming message away from the central webhook channel and to the desired channel (for which we have ~15-20 bot channels).

The method used mirrors the one in this article:https://medium.com/@sfjimmyjay/salesforce-to-slack-integration-1448b10d4f73 

With this new webhook the distribution is no longer successful and all the messages intended for these channels are flowing into the webhook channel exclusively. 

I have added the app to some of these channels to see if that was the problem, and that did not resolve the issue. 

Would appreciate anyone's thought or feedback on what I might need to change in terms of my methodology (should I not be doing this through a webhook any longer?), updating the code to allow the distribution to flow again, or what else I might need to do to get back to the previous functionality. 

Thank you!

Hey everyone! 
I'm an admin who is trying to move into coding and to translate what I've learned in Visual Flow into code to help me be able to tackle problems I can't resolve in VF.
I could do this in VF, but I'm using it as an example to try to translate what I know, and I'm running into some issues.

Greatly appreciate any help anyone can provide to help me on my first trigger and class.
Class
public class ServiceOrderClass {
    public static void getServiceForOrder(List<Service__c> servicefromTrigger)
 { 
     List<Order> relatedOrder= new List<Order>();
     Order foundorder = new Order();
     for (Service__c svc:servicefromTrigger)  
    {
        if (svc.First_Service_Order__c!=NULL && svc.Service_Order__c=='') 
        {
            relatedOrder=[Select Id, SAP_DocNum__c From Order WHERE SAP_DocNum__c=:svc.First_Service_Order__c]; 
            {System.debug('this is the related order record '+relatedOrder);}
            foundorder=relatedOrder[0];
           svc.Service_Order__c= foundorder.id;
        }
    }
     update servicefromTrigger;
  }
}

Trigger
trigger servicefromTrigger on Service__c (before update) 
{
 ServiceOrderClass.getServiceForOrder(trigger.new);
}
The error message I'm receiving when I try to update a service record is: servicefromTrigger: execution of BeforeUpdate cuased by System.StringException: Invalid Id : Class.ServiceOrderClass.getServiceforOrder: line 8, column 1 Trigger.servicefromTrigger: line 3, column 1

What I'm trying to do is pass the Service__c.Id from the Trigger to the list in the Class, check to see if the First_Service_Order__c field is populated and the Service_Order__c field is NULL, and if those conditions are met, find the order that hasw the same 6 digit order number as the First_Service_Order__c field and write that order to a lookup field Service__c.Service_Order__c

Thanks again for any help.
Frances
Hello there!
I'm just starting to learn about Apex, SOQL and classes. But I need to create a custom button on a related list to add related objects to the list. 
Using the code in this link: https://developer.salesforce.com/forums?id=906F0000000BKaUIAW, seems to have gotten me most of the way there, but I'm referencing a custom object, not a standard one, and I'm wondering if that could be the source of the problem?

I'm getting two errors:
Line 12 Constructor not defined [PublicationControllerClass.Publications__c].(PublicationControllerClass.Publications__c)
Line 42 Invalid character in Identifer Publications__c

public class PublicationControllerClass {

    //Our collection of the class/wrapper objects cPublication 
    public List<Publications__c> publicationList {get; set;}

    //This method uses a simple SOQL query to return a List of Publications
    public List<Publications__c> getPublications() {
        if(publicationList == null) {
            publicationList = new List<Publications__c>();
            for(Publications__c c: [select Id, Name, Publication_Type__c from Publications__c limit 20]) {
                // As each publication is processed we create a new Publication object and add it to the publicationList
                 publicationList.add(new Publications__c(c));
            }
        }
        return publicationList;
    }


    public PageReference processSelected() {

                //We create a new list of Publications that will be populated only with Publications if they are selected
        List<Publications__c> selectedPublications = new List<Publications__c>();

        //We will cycle through our list of cPublications and will check to see if the selected property is set to true, if it is we add the Publication to the selectedpublications list
        for(Publications__c Pub: getPublications()) {
            if(Pub.selected == true) {
                selectedPublications.add(Pub.Pub);
            }
        }

        // Now we have our list of selected Publications and can perform any type of logic we want
        System.debug('These are the selected Publications...');
        for(Publications__c pub: selectedPublications) {
            system.debug(pub);
        }
        publicationList=null; // we need this line if we performed a write operation  because getPublications gets a fresh list now
        return null;
    }


    // This is our wrapper/container class. A container class is a class, a data structure, or an abstract data type whose instances are collections of other objects. In this example a wrapper class contains both the object Publications and a Boolean value
    public class Publications__c {
        public Publications__c pub {get; set;}
        public Boolean selected {get; set;}

        //This is the contructor method. When we create a new cPublication object we pass a Publication that is set to the pub property. We also set the selected value to false
        public Publications__c (Publication c) {
            pub = c;
            selected = false;
        }
    }
}

I'm sure I'm missing something obvious, and appreciate any help.
Thanks!
 
Hello there!
I'm just starting to learn about Apex, SOQL and classes. But I need to create a custom button on a related list to add related objects to the list. 
Using the code in this link: https://developer.salesforce.com/forums?id=906F0000000BKaUIAW, seems to have gotten me most of the way there, but I'm referencing a custom object, not a standard one, and I'm wondering if that could be the source of the problem?

I'm getting two errors:
Line 12 Constructor not defined [PublicationControllerClass.Publications__c].(PublicationControllerClass.Publications__c)
Line 42 Invalid character in Identifer Publications__c

public class PublicationControllerClass {

    //Our collection of the class/wrapper objects cPublication 
    public List<Publications__c> publicationList {get; set;}

    //This method uses a simple SOQL query to return a List of Publications
    public List<Publications__c> getPublications() {
        if(publicationList == null) {
            publicationList = new List<Publications__c>();
            for(Publications__c c: [select Id, Name, Publication_Type__c from Publications__c limit 20]) {
                // As each publication is processed we create a new Publication object and add it to the publicationList
                 publicationList.add(new Publications__c(c));
            }
        }
        return publicationList;
    }


    public PageReference processSelected() {

                //We create a new list of Publications that will be populated only with Publications if they are selected
        List<Publications__c> selectedPublications = new List<Publications__c>();

        //We will cycle through our list of cPublications and will check to see if the selected property is set to true, if it is we add the Publication to the selectedpublications list
        for(Publications__c Pub: getPublications()) {
            if(Pub.selected == true) {
                selectedPublications.add(Pub.Pub);
            }
        }

        // Now we have our list of selected Publications and can perform any type of logic we want
        System.debug('These are the selected Publications...');
        for(Publications__c pub: selectedPublications) {
            system.debug(pub);
        }
        publicationList=null; // we need this line if we performed a write operation  because getPublications gets a fresh list now
        return null;
    }


    // This is our wrapper/container class. A container class is a class, a data structure, or an abstract data type whose instances are collections of other objects. In this example a wrapper class contains both the object Publications and a Boolean value
    public class Publications__c {
        public Publications__c pub {get; set;}
        public Boolean selected {get; set;}

        //This is the contructor method. When we create a new cPublication object we pass a Publication that is set to the pub property. We also set the selected value to false
        public Publications__c (Publication c) {
            pub = c;
            selected = false;
        }
    }
}

I'm sure I'm missing something obvious, and appreciate any help.
Thanks!