• Subhash R
  • NEWBIE
  • 0 Points
  • Member since 2015

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

I want to get the ID's of all the Process Builder (that I created) into an Apex Class. As i seen in Workbench, There is a particular ID for the Process Builders with the Particular Name appending the Version Number in last of that Name with ID too. Now I want to retrieve all the Process Builder IDs in an Apex Class.

Is there any way to do this by means of Metadata API (or) Is there any API directly to retrieve them?

Thanks in advance...
 
Hi, 

trying to set up the fullcalendar set up in Salesforce according to: https://gist.github.com/sjurgis/3c9ad1294b1466d7b910

Have imported everyting into my Salesforce org that was needed from the latest version of https://fullcalendar.io/ and named resources (import in visualforce page) 

Visualforce Page: 
<apex:page showHeader="false" standardStylesheets="false" controller="fullCalendar" standardstylesheets="false">
    
    <apex:stylesheet value="{!$Resource.fullCalendarCSS}"/>
    <apex:stylesheet value="{!$Resource.fullCalendarPrintCSS}"/>
    <apex:includeScript value="{!$Resource.fullCalendarMinJS}"/>
	<apex:includeScript value="{!$Resource.jQuery3}"/>
    <apex:includeScript value="{!$Resource.momentJS}"/>

   <body>             
   <script type="text/javascript"> 
      function getEventData() {                         // records are retrieved from soql database
        Visualforce.remoting.Manager.invokeAction(
            '{!$RemoteAction.fullCalendar.eventdata}',  // controller and method names
            function(result, event){
                if (event.status) {
                    evt =  JSON.parse(result);
                    $('#calendar').fullCalendar({       // html element and library name
                        events: evt                     
                    }) 
                } else if (event.type === 'exception') { 
                    console.log(event.message);
                } else {
                    console.log(event.message);
                }
            }, 
            {escape: false}
        );
    }
    $(document).ready(function() {
        getEventData();
    });
    </script>
    <div id="calendar"></div>
    </body>
</apex:page>

APEX Class:
public class fullCalendar {
    public string eventsJSON {get;set;}
    
    //The calendar plugin is expecting dates is a certain format. We can use this string to get it formated correctly
    static String dtFormat = 'EEE, d MMM yyyy HH:mm:ss z';

    @RemoteAction
    public static string eventdata(){
        calEvent[] events = new calEvent[]{};
        for(Event evnt: [select Id, Subject, isAllDayEvent, StartDateTime, EndDateTime from Event]){
            DateTime startDT = evnt.StartDateTime;
            DateTime endDT = evnt.EndDateTime;
            
            calEvent myEvent = new calEvent();
            myEvent.title = evnt.Subject;
            myEvent.allDay = evnt.isAllDayEvent;
            myEvent.startString = startDT.format(dtFormat);
            myEvent.endString = endDT.format(dtFormat);
            myEvent.url = '/' + evnt.Id;
            myEvent.className = 'event-personal';
            events.add(myEvent);
        }
        
        string jsonEvents = JSON.serialize(events);
        jsonEvents = jsonEvents.replace('startString','start');
        jsonEvents = jsonEvents.replace('endString','end');
        
        return jsonEvents;
    }

    // Class to hold calendar event data
    public class calEvent {
        public String title {get;set;}
        public Boolean allDay {get;set;}
        public String startString {get;set;}
        public String endString {get;set;}
        public String url {get;set;}
        public String className {get;set;}
    }
}

Apex Test:
@isTest
class FullCalendarTest {
	
    static testMethod void testfullCalendar (){
    event[] bulklist= new event[]{};
	for (integer i = 0; i < 200; i++)
    {
        string srnd = string.valueOf(math.random());
        blob rnd = Blob.valueOf(srnd);
        bulklist.add(new event (
            subject=encodingUtil.base64Encode(rnd),
            startDateTime=system.now().addDays(-10+ (math.random() * 10 ).intValue()),
            isAllDayEvent=true     
        ) );
    }
    insert bulklist;
}
}

I get absolutely no error and test is passing as well. But have the following problems:

1. When i actually try to preview the page nothing happens / completely blank page
2. Test is passing but I get 0 Code Coverage for my class 

All help very much appreciated to get this to work. 
 
Hi,

I want to get the ID's of all the Process Builder (that I created) into an Apex Class. As i seen in Workbench, There is a particular ID for the Process Builders with the Particular Name appending the Version Number in last of that Name with ID too. Now I want to retrieve all the Process Builder IDs in an Apex Class.

Is there any way to do this by means of Metadata API (or) Is there any API directly to retrieve them?

Thanks in advance...
 
I have taken Two Objects and i am giving the lookup Then how to Display the field values on vf Page.