• Sahaj
  • NEWBIE
  • 40 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 12
    Questions
  • 11
    Replies
Hi All,

Please help me with this code.
trigger catgUpdate on BMCServiceDesk__Incident__c (before insert,before update) 
{
    set<id> inc1 = new set<id>();
for(BMCServiceDesk__Incident__c inc : trigger.new)
{
    inc1.add(inc.BMCServiceDesk__FKBMC_BaseElement__c);
   
    List<BMCServiceDesk__BMC_BaseElement__c> bE = [Select id,Product_Categorization_Tier_1__c,Category_CI__c,Sub_Category_CI__c from BMCServiceDesk__BMC_BaseElement__c where id IN :inc1];
    If(bE.size()> 0)
    {
    inc.Parent__c = bE[0].Category_CI__c;
    inc.Child__c = bE[0].Sub_Category_CI__c;
    //inc.Product_1__c = bE[0].Product_Categorization_Tier_1__c;    
}
}
}

This code is working fine and Parent__c(lookup) and Child__c(lookup) values are autopopulated when I save the record.
when I edit the record and click on Parent__c or  Child__c lookup icon, it gives error ie System.NullPointerException: Attempt to de-reference a null object. Please let me know the issue

Thanks in advance.

Sahaj
 
  • April 22, 2016
  • Like
  • 0
Hi,
Please help me to fix this error. 
Below is the code
Thanks :)
 
Global class Moogsoft {
    @future (callout=true)
    public static  void getMoog(String inc, Decimal moog,id iid) {
        HttpResponse  res = authToken();
        String authT;
        JSONParser parser = JSON.createParser(res.getBody());
            while (parser.nextToken() != null) {
                if (parser.getCurrentToken() == JSONToken.FIELD_NAME){
                    String fieldName = parser.getText();
                    parser.nextToken();
                     if(fieldName == 'auth_token' ) {
                        authT = parser.getText();
                        system.debug('++++++++++'+authT);
                    }
                }
            }
        system.debug('####'+authT);
        HttpResponse  firstc = firstCall(inc,moog,authT);
        system.debug('####first'+firstc.getbody());
        HttpResponse secondC = secondCall(inc,moog,authT);
        system.debug('####'+secondC);
        HttpResponse thirdC = thirdCall(iid,moog,authT);
        system.debug('####'+thirdC);
        
    }
     public static httpResponse authToken() {
        String URL1 = 'pqr.com';
        HttpResponse resData = HTTPCallout(URL1, 'GET');
        System.debug('Response from Moog: ('+resData.getStatusCode()+')'+resData.getBody());
           if(resData.getStatusCode()>299) {
            String error = 'Failed getting a request token. HTTP Code = '+resData.getStatusCode()+
                            '. Message: '+resData.getStatus()+'. Response Body: '+resData.getBody();
            system.debug('failed'+error);
               MoogError__c me = new MoogError__c();
               me.MoogError1__c = error;
               insert me;
               
               return resdata;
                } 
         
          else {
            return resData;
            }
     }
    public static httpResponse firstCall(String a1,Decimal b1,String c1) {
        String aa = a1;
        Decimal bb = b1;
        String cc = c1;
        System.debug('####'+cc);
        System.debug('####'+aa);
        String URL2 = 'abc.com';
        HttpResponse res = HTTPCallout(URL2, 'POST');
        System.debug('Response from Code request: ('+res.getStatusCode()+')'+res.getBody());

        if(res.getStatusCode()>299) {
            String error = 'Request failed error.HTTP Code = '+res.getStatusCode()+'. Message: '+res.getStatus()+'. Response Body: '+res.getBody()+'auth_token='+cc+'&sitn_id='+bb+'&service_name=Remedyforce&resource_id='+aa+'';
            System.debug('##### Failed: '+error);
            MoogError__c me = new MoogError__c();
            me.MoogError2__c = error;
            insert me;
            system.debug(me);
            system.debug('value of'+me.MoogError2__c);
           return res;
        }
        
        
        return res;
        
        }

    public static httpResponse secondCall(String a2,Decimal b2,String c2) {
        String aa = a2;
        Decimal bb = b2;
        String cc =  c2;
        
        
     String URL3 = 'abc.com;
        
       
        HttpResponse resT = HTTPCallout(URL3, 'POST');
        System.debug('Response from Code request: ('+resT.getStatusCode()+')'+resT.getBody());

        if(resT.getStatusCode()>299) {
            String error = 'Request failed error.HTTP Code = '+resT.getStatusCode()+'. Message: '+resT.getStatus()+'. Response Body: '+resT.getBody()+'auth_token='+cc+'&sitn_id='+bb+'&custom_info=%7B%22incrf%22%3A%22'+aa+'%22%7D';
            System.debug('##### Failed: '+error);
            MoogError__c me = new MoogError__c();
            me.MoogError3__c = error;
            insert me;
            
            
            return resT;
        }
        
        
         system.debug('success');
        return resT;
             
    }
   
    public static httpResponse thirdCall(id a2,Decimal b2,String c2) {
        id aa = a2;
        Decimal bb = b2;
        String cc =  c2;
        System.debug('3rd call');
        
      String URL3 = 'pqr.com';
              HttpResponse resm = HTTPCallout(URL3, 'POST');
        System.debug('Response from Code request: ('+resm.getStatusCode()+')'+resm.getBody());

        if(resm.getStatusCode()>299) {
            String error = 'Request failed error.HTTP Code = '+resm.getStatusCode()+ '. Message: '+resm.getStatus()+'. Response Body: '+resm.getBody()+'auth_token='+cc+'&sitn_id='+bb+'&custom_info=%7B%22incrfer%22%3A%22'+aa+'%22%7D';
            System.debug('##### Failed: '+error);
            MoogError__c me = new MoogError__c();
           me.MoogError4__c = error;
            insert me;
           
            return resm ;
        }
        

   
        system.debug('sucessfull');
        return resm;
    }

    public Static HttpResponse HTTPCallout(String EndPoint, String Method) {
        Http h = new Http();
        HttpRequest req= new HttpRequest();
        req.setEndpoint(EndPoint);
        req.setMethod(Method);
        HttpResponse res = null;
        res = h.send(req);
        return res;
    }
}

 
  • December 24, 2015
  • Like
  • 0
Hi All,
I am trying to cover the mentioned callout but I am able to achieve 59%. I am unable to cover first method ie getMoog and  all the if statements.
I know there are lots of errors in my code as I am new to technology but currently its working for me, please suggest me to make my code more and more mature.
Global class Moogsoft {
    @future (callout=true)
    public static  void getMoog(String inc, Decimal moog,id iid) {
        HttpResponse  res = authToken();
        String authT;
        JSONParser parser = JSON.createParser(res.getBody());
            while (parser.nextToken() != null) {
                if (parser.getCurrentToken() == JSONToken.FIELD_NAME){
                    String fieldName = parser.getText();
                    parser.nextToken();
                     if(fieldName == 'auth_token' ) {
                        authT = parser.getText();
                        system.debug('++++++++++'+authT);
                    }
                }
            }
        system.debug('####'+authT);
        HttpResponse  firstc = firstCall(inc,moog,authT);
        system.debug('####first'+firstc.getbody());
        HttpResponse secondC = secondCall(inc,moog,authT);
        system.debug('####'+secondC);
        HttpResponse thirdC = thirdCall(iid,moog,authT);
        system.debug('####'+thirdC);
        
    }
     public static httpResponse authToken() {
        String URL1 = 'abc.com';
        HttpResponse resData = HTTPCallout(URL1, 'GET');
        System.debug('Response from Moog: ('+resData.getStatusCode()+')'+resData.getBody());
           if(resData.getStatusCode()>299) {
            String error = 'Failed getting a request token. HTTP Code = '+resData.getStatusCode()+
                            '. Message: '+resData.getStatus()+'. Response Body: '+resData.getBody();
            system.debug('failed'+error);
               return resdata;
            } 
         
          else {
            return resData;
            }
     }
    public static httpResponse firstCall(String a1,Decimal b1,String c1) {
        String aa = a1;
        Decimal bb = b1;
        String cc = c1;
        System.debug('####'+cc);
        System.debug('####'+aa);
        String URL2 = 'abc.com'';
        HttpResponse res = HTTPCallout(URL2, 'POST');
        System.debug('Response from Code request: ('+res.getStatusCode()+')'+res.getBody());

        if(res.getStatusCode()>299) {
            String error = 'Request failed error.HTTP Code = '+res.getStatusCode()+
                        '. Message: '+res.getStatus()+'. Response Body: '+res.getBody();
            System.debug('##### Failed: '+error);
            return res;
        }
        
        
        return res;
        
        }

    public static httpResponse secondCall(String a2,Decimal b2,String c2) {
        String aa = a2;
        Decimal bb = b2;
        String cc =  c2;
        
        
     String URL3 = 'abc.com';
        
       
        HttpResponse resT = HTTPCallout(URL3, 'POST');
        System.debug('Response from Code request: ('+resT.getStatusCode()+')'+resT.getBody());

        if(resT.getStatusCode()>299) {
            String error = 'Request failed error.HTTP Code = '+resT.getStatusCode()+
                        '. Message: '+resT.getStatus()+'. Response Body: '+resT.getBody();
            System.debug('##### Failed: '+error);
            return resT;
        }
        
        
         system.debug('success');
        return resT;
             
    }
   
    public static httpResponse thirdCall(id a2,Decimal b2,String c2) {
        id aa = a2;
        Decimal bb = b2;
        String cc =  c2;
        System.debug('3rd call');
        
      String URL3 = 'abc.com';
       
        HttpResponse resm = HTTPCallout(URL3, 'POST');
        System.debug('Response from Code request: ('+resm.getStatusCode()+')'+resm.getBody());

        if(resm.getStatusCode()>299) {
            String error = 'Request failed error.HTTP Code = '+resm.getStatusCode()+
                        '. Message: '+resm.getStatus()+'. Response Body: '+resm.getBody();
            System.debug('##### Failed: '+error);
            return resm ;
        }
        

   
        system.debug('sucessfull');
        return resm;
    }

    public Static HttpResponse HTTPCallout(String EndPoint, String Method) {
        Http h = new Http();
        HttpRequest req= new HttpRequest();
        req.setEndpoint(EndPoint);
        req.setMethod(Method);
        HttpResponse res = null;
        res = h.send(req);
        return res;
    }
}
Below is my test class.
@isTest
public class MoogsoftTest {
   static testMethod void moogcallout(){
        // Create the mock response based on a static resource
    StaticResourceCalloutMock mock = new StaticResourceCalloutMock();
        mock.setStaticResource('TestResponse1');
        mock.setStatusCode(200);
        mock.setHeader('Content-Type', 'application/json;charset=UTF-8');
       // Associate the callout with a mock response
      Test.setMock(HttpCalloutMock.class, mock);
       // Call method to test
      
        HttpResponse result = Moogsoft.authToken();
       // Verify mock response is not null
     System.assertNotEquals(null,result, 'The callout returned a null response.');
      // String error = 'Failed getting a request token. HTTP Code = '+result.getStatusCode()+
           //                 '. Message: '+result.getStatus()+'. Response Body: '+result.getBody();
           // system.debug('failed'+error);
     System.assertEquals(200,result.getStatusCode(),result);
       
       HttpResponse res = Moogsoft.firstCall('ca5c44d8a9df405486f41e8dde87f8fb',12345,'0004321');
       System.assertNotEquals(null,res, 'The callout returned a null response.');
       System.assertEquals(200,res.getStatusCode(),result);
       
       HttpResponse rep = Moogsoft.secondCall('ca5c44d8a9df405486f41e8dde87f8fb',12345,'0004321');
       System.assertNotEquals(null,rep, 'The callout returned a null response.');
       System.assertEquals(200,res.getStatusCode(),result);
       
        HttpResponse rem = Moogsoft.thirdCall('a1TO0000002j3yb',12345,'0004321');
       System.assertNotEquals(null,rem, 'The callout returned a null response.');
       System.assertEquals(200,rem.getStatusCode(),result);
       
       
       
       
       }
}

Please help
Thanks in advance.. :)
 
  • December 22, 2015
  • Like
  • 0
Hi All,

I have the url like https://events.ktass.com/graze/v1/addSituationCustomInfo?auth_token='+cc+'&sitn_id='+bb+'&custom_info={incrf":'+aa+'}
I want to apend json string like this  custom_info={'incrf':'aa'}
How can I achieve this, Please help 
Thanks
 
  • December 16, 2015
  • Like
  • 0
Hi All,

How can i hardcode createddate(standard field) value in my trigger. PFB  code but i am getting an unexpected token error.
 
incident.Createddate>2013-19-12T11:30:40.000Z

 
  • December 14, 2015
  • Like
  • 0
Hi All, 

I am recieving 200 response code,instead of 201 for record insertion. Can you please help. PFB code and debug logs.
Thanks alot..
Global class Moogsoft {
    @future (callout=true)
    public static void getMoog(Integer inc, Integer moog) {
        String authT = authToken();
        system.debug('####'+authT);
        String firstC = firstCall(inc,moog,authT);
        system.debug('####'+firstC);
        String secondC = secondCall(inc,moog,authT);
        system.debug('####'+secondC);
    }

    public static string authToken() {
        String URL1 = 'https://events5.mop.com:8080/graze/v1/authenticate?username=graze&password=graze';
        HttpResponse resData = HTTPCallout(URL1, 'GET');
        System.debug('Response from Moog: ('+resData.getStatusCode()+')'+resData.getBody());

        String authToken;

        if(resData.getStatusCode()>299) {
            String error = 'Failed getting a request token. HTTP Code = '+resData.getStatusCode()+
                            '. Message: '+resData.getStatus()+'. Response Body: '+resData.getBody();
            system.debug('failed'+error);
        } else {
            JSONParser parser = JSON.createParser(resData.getBody());
            while (parser.nextToken() != null) {
                if (parser.getCurrentToken() == JSONToken.FIELD_NAME){
                    String fieldName = parser.getText();
                    parser.nextToken();

                    if(fieldName == 'auth_token' ) {
                        authToken = parser.getText();
                        system.debug('++++++++++'+authToken);
                    }
                }
            }
        }

        return authtoken;
    }

    public static string firstCall(Integer a1,Integer b1,String c1) {
        Integer aa = a1;
        Integer bb = b1;
        String cc = c1;
        System.debug('####'+cc);
        String URL2 = 'https://events5.mop.com:8080/graze/v1/addSigCorrelationInfo?auth_token='+cc+'&sitn_id='+bb+'&service_name=Remedyforce&resource_id='+aa+'';
        HttpResponse res = HTTPCallout(URL2, 'POST');
        System.debug('Response from Code request: ('+res.getStatusCode()+')'+res.getBody());

        if(res.getStatusCode()>299) {
            String error = 'Request failed error.HTTP Code = '+res.getStatusCode()+
                        '. Message: '+res.getStatus()+'. Response Body: '+res.getBody();
            System.debug('##### Failed: '+error);
            return error;
        }
            
        String suc ='successfull';
        return suc;
    }

    public static string secondCall(Integer a2,Integer b2,String c2) {
        Integer aa = a2;
        Integer bb = b2;
        String cc =  c2;
        String URL3 = 'https://ev.mop.com:8080/graze/v1/addSituationCustomInfo?auth_token='+cc+'&sitn_id='+bb+'&custom_info={incrf:'+aa+'}';
        HttpResponse resT = HTTPCallout(URL3, 'POST');
        System.debug('Response from Code request: ('+resT.getStatusCode()+')'+resT.getBody());

        if(resT.getStatusCode()>299) {
            String error = 'Request failed error.HTTP Code = '+resT.getStatusCode()+
                        '. Message: '+resT.getStatus()+'. Response Body: '+resT.getBody();
            System.debug('##### Failed: '+error);
            return error;
        }

        String suc ='successfull';
        return suc;
    }

    public Static HttpResponse HTTPCallout(String EndPoint, String Method) {
        Http h = new Http();
        HttpRequest req= new HttpRequest();
        req.setEndpoint(EndPoint);
        req.setMethod(Method);
        HttpResponse res = null;
        res = h.send(req);
        return res;
    }
}

User-added image
  • December 12, 2015
  • Like
  • 0
Hi Community,

I am trying to do callout but i am getting the below error.
Only top-level class variables can be declared static Line 39
I know there are lots of other error too as I am beginer. Please help me with the below code
Thanks
global class Moogsoft {
    
    @future (callout=true)
    public static void getMoog(String inc,String moog)
    {
        
        String authT = getAuth();
        system.debug('####'+authToken);
        String firstC = updateMoog1(inc,moog,authToken);
        system.debug('####'+firstC);
        String secondC = updateMoog2(inc,moog,authToken);
        system.debug('####'+secondC);
    }
    
    public static string authToken()
    {
    String URL1 = 'https://events5.hclmtaas.com:8080/graze/v1/authenticate?username=graze&password=graze';
    HttpResponse resData = HTTPCallout(URL1, 'GET');   
    System.debug('Response from Moog: ('+resData.getStatusCode()+')'+resData.getBody());    
    if(resData.getStatusCode()>299) {
     String error = 'Failed getting a request token. HTTP Code = '+resData.getStatusCode()+
                      '. Message: '+resData.getStatus()+'. Response Body: '+resData.getBody();
     system.debug('failed'+error);
    }
     else{
     JSONParser parser = JSON.createParser(resData.getBody());
      while (parser.nextToken() != null) {
      if (parser.getCurrentToken() == JSONToken.FIELD_NAME){  
       String fieldName = parser.getText();
        parser.nextToken();
        if(fieldName == 'auth_token' ) {
        authToken = parser.getText();
        system.debug('++++++++++'+authToken);
            
        }
                    return authtoken;
    }
    
    public static string firstCall(String a1,String b1,String c1)
    {
        String URL2 = 'abcd.com';
        HttpResponse res = HTTPCallout(URL2, 'POST'); 
        System.debug('Response from Code request: ('+res.getStatusCode()+')'+res.getBody());
        if(res.getStatusCode()>299)
        {
           String error = 'Failed from moog.HTTP Code = '+res.getStatusCode()+
                      '. Message: '+res.getStatus()+'. Response Body: '+res.getBody();
             System.debug('##### Failed: '+error);
            return error;
        }
        else{
            return null;
        }
    }
          
        public static string secondCall(String a2,String b2,String c2)
        {
            
            String URL3 = 'qrws.com';
            HttpResponse resT = HTTPCallout(EP2, 'POST'); 
            System.debug('Response from Code request: ('+resT.getStatusCode()+')'+resT.getBody());
        if(resT.getStatusCode()>299)
        {
           String error = 'Failed from moog.HTTP Code = '+resT.getStatusCode()+
                      '. Message: '+resT.getStatus()+'. Response Body: '+resT.getBody();
             System.debug('##### Failed: '+error);
            return error;
        }
        else{
            return null;
        }
            
            
        }
        
        
    public Static HttpResponse HTTPCallout(String EndPoint, String Method) {
         Http h = new Http();
         HttpRequest req= new HttpRequest();
         req.setEndpoint(EndPoint);
         req.setMethod(Method);         
         HttpResponse res = null;        
         res = h.send(req);
         return res;
     }
        
        

}


 
  • December 09, 2015
  • Like
  • 0
Hi
Please help me with Attempt to de-reference a null object,how can i resolve this issue
Error is in expression '{!doGeneration}' in page updateincidentremelaptime: Class.GenerateRemainingElapsedTime.doGeneration: line 63, column 1
Below is the sample code(controller) and VF page
Public Class GenerateRemainingElapsedTime{
    public List<BMCServiceDesk__Incident_Service_Target__c> listIncidentServiceTarget{get;set;}
    public Boolean IsGenerated{get;set;}
    Public GenerateRemainingElapsedTime(){
        IsGenerated=false;    
        listIncidentServiceTarget=
                      [SELECT Id, BMCServiceDesk__FKIncident__r.Owner_new__c, BMCServiceDesk__FKIncident__r.Summary__c, Name, BMCServiceDesk__ElapsedTime__c, BMCServiceDesk__FKIncident__r.PendingStartTime__c, BMCServiceDesk__FKIncident__r.PendingDuration__c, BMCServiceDesk__TimeRemaining__c, BMCServiceDesk__StateValue__c, BMCServiceDesk__StartDate__c, BMCServiceDesk__Support_Hour_Applied__c, BMCServiceDesk__PausedDuration__c, BMCServiceDesk__TargetEndDate__c, BMCServiceDesk__FKIncident__r.Status_picklist__c ,BMCServiceDesk__FKIncident__r.Name, BMCServiceDesk__FKIncident__c FROM BMCServiceDesk__Incident_Service_Target__c 
                      WHERE                         
                      BMCServiceDesk__TargetType__c ='ResolutionTime'  AND 
                      BMCServiceDesk__IsCanceled__c = false AND  
                      BMCServiceDesk__StateValue__c <> 'Canceled' AND
                      BMCServiceDesk__FKIncident__r.Status_picklist__c IN ('Assigned','In Progress', 'Pending') AND
                      createddate > 2015-10-29T00:00:00.000Z];    
        System.Debug('####Controller-listIncidentServiceTarget: '+listIncidentServiceTarget);                      
    }
    //Format Date As String
    Public String formatMS(Long timeInMilliSeconds){
            Long seconds = timeInMilliSeconds / 1000;
            Long minutes = seconds / 60;
            Long hours = minutes / 60;
            Long days = hours / 24;
            String timeF = days + ' day(s) ' + AppendZero(Math.mod(hours,24)) + ':' + AppendZero(Math.mod(minutes,60)) + ':' + AppendZero(Math.mod(seconds,60))+' HH:MM:SS'; 
            return timeF ;
    }
    Public String AppendZero(Long num){
            String timeF;
            if(num<10){
                timeF='0'+num;
            }else{
                timeF=''+num;
            }
            return timeF ;
    }
    
    //Method Call
    Public PageReference doGeneration(){
            //Get Incident Service Target        
            listIncidentServiceTarget=
                      [SELECT Id, Name, BMCServiceDesk__FKIncident__r.Owner_new__c, BMCServiceDesk__FKIncident__r.Summary__c, BMCServiceDesk__ElapsedTime__c, BMCServiceDesk__FKIncident__r.PendingStartTime__c, BMCServiceDesk__FKIncident__r.PendingDuration__c, BMCServiceDesk__TimeRemaining__c, BMCServiceDesk__StateValue__c, BMCServiceDesk__StartDate__c, BMCServiceDesk__Support_Hour_Applied__c, BMCServiceDesk__PausedDuration__c, BMCServiceDesk__TargetEndDate__c, BMCServiceDesk__FKIncident__r.Status_picklist__c ,BMCServiceDesk__FKIncident__r.Name, BMCServiceDesk__FKIncident__c FROM BMCServiceDesk__Incident_Service_Target__c 
                      WHERE                         
                      BMCServiceDesk__TargetType__c ='ResolutionTime'  AND 
                      BMCServiceDesk__IsCanceled__c = false AND  
                      BMCServiceDesk__StateValue__c <> 'Canceled' AND
                      BMCServiceDesk__FKIncident__r.Status_picklist__c IN ('Assigned','In Progress', 'Pending') AND
                      createddate > 2015-12-05T00:00:00.000Z];
           IsGenerated=true;
           System.Debug('####Controller-listIncidentServiceTarget: '+listIncidentServiceTarget);    
           for(BMCServiceDesk__Incident_Service_Target__c ist : listIncidentServiceTarget){
               System.Debug('####Controller-ist: '+ist );    
                if(ist.BMCServiceDesk__StartDate__c!=null && ist.BMCServiceDesk__TargetEndDate__c !=null){
                    DateTime startDate= ist.BMCServiceDesk__StartDate__c  ;
                    DateTime endDate= ist.BMCServiceDesk__TargetEndDate__c ;
                    //Total Time
                    Long totalTime=BusinessHours.diff(ist.BMCServiceDesk__Support_Hour_Applied__c, startDate, endDate);
                    //Elapsed Time
                    Long elapsedTime=BusinessHours.diff(ist.BMCServiceDesk__Support_Hour_Applied__c, startDate, DateTime.Now());
                    //Remaining Time
                    Long remainingTime;
                    String fRemainingTime;
                    if(ist.BMCServiceDesk__FKIncident__r.Status_picklist__c=='Pending'){
                        //Dynamic Calculation
                        //Decimal pendingTime=BusinessHours.diff(ist.BMCServiceDesk__Support_Hour_Applied__c, ist.BMCServiceDesk__FKIncident__r.PendingStartTime__c, DateTime.Now());
                        Long pendingTime=(ist.BMCServiceDesk__FKIncident__r.PendingDuration__c).longValue()+BusinessHours.diff(ist.BMCServiceDesk__Support_Hour_Applied__c, ist.BMCServiceDesk__FKIncident__r.PendingStartTime__c, DateTime.Now());
                        elapsedTime=elapsedTime-pendingTime;
                        remainingTime=BusinessHours.diff(ist.BMCServiceDesk__Support_Hour_Applied__c,ist.BMCServiceDesk__FKIncident__r.PendingStartTime__c, endDate);  
                        fRemainingTime=formatMS(remainingTime);
                                             
                    }else{
                        //Static Calculation
                        elapsedTime=elapsedTime-(ist.BMCServiceDesk__FKIncident__r.PendingDuration__c).longValue();
                        if(DateTime.Now()>endDate){
                        //remainingTime=elapsedTime-totalTime;
                        remainingTime=BusinessHours.diff(ist.BMCServiceDesk__Support_Hour_Applied__c, endDate, DateTime.Now());  
                        fRemainingTime='- '+formatMS(remainingTime);  
                        }else{
                            //remainingTime=totalTime-elapsedTime;
                            remainingTime=BusinessHours.diff(ist.BMCServiceDesk__Support_Hour_Applied__c, DateTime.Now(), endDate);  
                            fRemainingTime=formatMS(remainingTime);                            
                        }
                    }                 
                    String fElapsedTime=formatMS(elapsedTime);
                    
                    System.debug('####----------------Incident Number: '+ist.BMCServiceDesk__FKIncident__r.Name+' Status: '+ist.BMCServiceDesk__FKIncident__r.Status_picklist__c);
                    System.debug('####Total Time: '+totalTime);
                    System.debug('####Elapsed Time: '+fElapsedTime);
                    System.debug('####Remaining Time: '+fRemainingTime);      
                    
                    ist.BMCServiceDesk__ElapsedTime__c=fElapsedTime;
                    ist.BMCServiceDesk__TimeRemaining__c=fRemainingTime;                 
                    
                }
        }
        return null;
         
    }

    public PageReference CreatePDF(){
      PageReference pageRef = new PageReference('/apex/RemElapPDF');
      pageRef.setRedirect(false);
      return pageRef;  
    }
     

}
 
<apex:page tabStyle="BMCServiceDesk__Incident_Service_Target__c" controller="GenerateRemainingElapsedTime">
 <style type="text/css">         
        .btnCSS {    
            padding:3px;
            margin:2px 2px 0 2px;
            font: bold 13px Arial, Helvetica, sans-serif;
            width:90px;        
            -moz-border-radius  : 2px; 
            -webkit-border-radius: 2px;            
            cursor:pointer;
            text-decoration: none !important;
            background:   #8C004C;
            background-color:#8C004C;
            border: 1px solid #8C004C;  
            color:#FFF!important;
            
        }
        .btnCSS:hover { 
            text-decoration: none !important;
            background:   #8C004C;
            background-color:#8C004C;
            border: 1px solid #8C004C;  
            color: #FFF!important;
        }
 </style>          
  <apex:sectionHeader title="Generate Remaining/Elapsed Time" help="https://help.salesforce.com/htviewhelpdoc?err=1&id=admin_transfer.htm&siteLang=en_US" />
  This screen allows you to generate Remaining/Elapsed Time of Incident Service Target of <b>Assigned</b>, <b>In Progress</b> and <b>Pending</b> incidents.
  <apex:form id="frm">        
      <apex:pageMessages />
      <apex:actionFunction status="asRefresh" action="{!doGeneration}" name="doGeneration" reRender="oPanel,oPanel1"/>      
      <apex:pageBlock id="pB" mode="maindetail">
        <apex:pageBlockButtons location="top" >
            <button title="Generate" type="button" class="btnCSS" onclick="doGeneration();">Generate</button> 
            <apex:outputPanel id="oPanel1">                   
            <apex:commandLink rendered="{!IsGenerated}"   title="Download in XLS" value="Download in XLS" styleClass="btnCSS" action="{!CreatePDF}"/>   
            </apex:outputPanel>        
             <apex:actionstatus id="asRefresh">
                <apex:facet name="start">
                      <img style="margin-bottom:-3px;margin-top:5px;float:right" src="/img/loading.gif" title="Please Wait..." />
                </apex:facet>
            </apex:actionstatus>       
        </apex:pageBlockButtons>   

        <apex:outputPanel id="oPanel">
        <apex:variable value="{!0}" var="rowNum" />
         <apex:pageBlockSection title="Remaining/Elapsed Time to be generated for below Incident Service Target"  collapsible="false" columns="1">  
              <apex:pageBlockTable value="{!listIncidentServiceTarget}" var="t">
                  <apex:column headerValue="#">
                    <apex:outputText value="{!rowNum + 1}"/>                  
                     <apex:variable var="rowNum" value="{!rowNum + 1}"/>
                  </apex:column>                  
                  <apex:column headerValue="Incident">
                      <apex:outputLink target="_blank" value="/apex/BMCServiceDesk__incidentConsole?record_id={!t.BMCServiceDesk__FKIncident__r.Id}" >{!t.BMCServiceDesk__FKIncident__r.Name}</apex:outputLink>
                  </apex:column>
                  <apex:column headerValue="Incident Service Target">
                      <apex:outputLink target="_blank" value="/{!t.Id}" >{!t.Name}</apex:outputLink>
                  </apex:column>                 
                  <apex:column headerValue="Queue" value="{!t.BMCServiceDesk__FKIncident__r.Owner_new__c}"/> 
                  <apex:column headerValue="Status" value="{!t.BMCServiceDesk__FKIncident__r.Status_picklist__c}"/>                  
                  <apex:column headerValue="Summary" value="{!t.BMCServiceDesk__FKIncident__r.Summary__c}"/>
                  <apex:column headerValue="Elapsed Time" rendered="{!IsGenerated}" value="{!t.BMCServiceDesk__ElapsedTime__c}"/>
                  <apex:column headerValue="Remaining Time" rendered="{!IsGenerated}"  value="{!t.BMCServiceDesk__TimeRemaining__c}"/>
                  
              </apex:pageBlockTable>
          </apex:pageBlockSection>
          </apex:outputPanel>  
      </apex:pageBlock> 
  </apex:form>     
</apex:page>

Please help me with this. :)
 
  • December 06, 2015
  • Like
  • 0
I want to integrate my salesforce org with a tool named Moogsoft . Whenever a record is created at my end.
 I have to update the other environment(moogsoft) using the below URL
https://etamtsvpmoogdv01:8080/graze/v1/addSigCorrelationInfo?auth_token=cc63c187531b46e3a2abfa716a34bc74&sitn_id=<situation_id>&service_name=Remedyforce&resource_id=<RF_ticket_id>

auth_token
in above URL can be fetched using the below link
https://etamtsvpmoogdv01:8080/graze/v1/authenticate?username=graze&password=graze
This link returns auth_token

situation_id : It is one of the field at my end(at salesforce side)

RF_ticket_id : the name/serial number of the record that is created at salesforce side.


Please let me know how this can be done ,if any more information is required please let me know.

Thanks alot :)



 
  • November 26, 2015
  • Like
  • 0
Hi All,
I work on remedyforce tool. I want to create a email service in which whenever a person sends email to that email service an incident(incident object) get generated.
Please help me out.
  • November 04, 2014
  • Like
  • 0
Hi
Please help me i want a workflow whenever a queue changes for the 4th time a mail get trigger to specific people.
  • October 20, 2014
  • Like
  • 0
Hi All,

Please help me with this code.
trigger catgUpdate on BMCServiceDesk__Incident__c (before insert,before update) 
{
    set<id> inc1 = new set<id>();
for(BMCServiceDesk__Incident__c inc : trigger.new)
{
    inc1.add(inc.BMCServiceDesk__FKBMC_BaseElement__c);
   
    List<BMCServiceDesk__BMC_BaseElement__c> bE = [Select id,Product_Categorization_Tier_1__c,Category_CI__c,Sub_Category_CI__c from BMCServiceDesk__BMC_BaseElement__c where id IN :inc1];
    If(bE.size()> 0)
    {
    inc.Parent__c = bE[0].Category_CI__c;
    inc.Child__c = bE[0].Sub_Category_CI__c;
    //inc.Product_1__c = bE[0].Product_Categorization_Tier_1__c;    
}
}
}

This code is working fine and Parent__c(lookup) and Child__c(lookup) values are autopopulated when I save the record.
when I edit the record and click on Parent__c or  Child__c lookup icon, it gives error ie System.NullPointerException: Attempt to de-reference a null object. Please let me know the issue

Thanks in advance.

Sahaj
 
  • April 22, 2016
  • Like
  • 0
Hi All,

How can i hardcode createddate(standard field) value in my trigger. PFB  code but i am getting an unexpected token error.
 
incident.Createddate>2013-19-12T11:30:40.000Z

 
  • December 14, 2015
  • Like
  • 0
Hi All, 

I am recieving 200 response code,instead of 201 for record insertion. Can you please help. PFB code and debug logs.
Thanks alot..
Global class Moogsoft {
    @future (callout=true)
    public static void getMoog(Integer inc, Integer moog) {
        String authT = authToken();
        system.debug('####'+authT);
        String firstC = firstCall(inc,moog,authT);
        system.debug('####'+firstC);
        String secondC = secondCall(inc,moog,authT);
        system.debug('####'+secondC);
    }

    public static string authToken() {
        String URL1 = 'https://events5.mop.com:8080/graze/v1/authenticate?username=graze&password=graze';
        HttpResponse resData = HTTPCallout(URL1, 'GET');
        System.debug('Response from Moog: ('+resData.getStatusCode()+')'+resData.getBody());

        String authToken;

        if(resData.getStatusCode()>299) {
            String error = 'Failed getting a request token. HTTP Code = '+resData.getStatusCode()+
                            '. Message: '+resData.getStatus()+'. Response Body: '+resData.getBody();
            system.debug('failed'+error);
        } else {
            JSONParser parser = JSON.createParser(resData.getBody());
            while (parser.nextToken() != null) {
                if (parser.getCurrentToken() == JSONToken.FIELD_NAME){
                    String fieldName = parser.getText();
                    parser.nextToken();

                    if(fieldName == 'auth_token' ) {
                        authToken = parser.getText();
                        system.debug('++++++++++'+authToken);
                    }
                }
            }
        }

        return authtoken;
    }

    public static string firstCall(Integer a1,Integer b1,String c1) {
        Integer aa = a1;
        Integer bb = b1;
        String cc = c1;
        System.debug('####'+cc);
        String URL2 = 'https://events5.mop.com:8080/graze/v1/addSigCorrelationInfo?auth_token='+cc+'&sitn_id='+bb+'&service_name=Remedyforce&resource_id='+aa+'';
        HttpResponse res = HTTPCallout(URL2, 'POST');
        System.debug('Response from Code request: ('+res.getStatusCode()+')'+res.getBody());

        if(res.getStatusCode()>299) {
            String error = 'Request failed error.HTTP Code = '+res.getStatusCode()+
                        '. Message: '+res.getStatus()+'. Response Body: '+res.getBody();
            System.debug('##### Failed: '+error);
            return error;
        }
            
        String suc ='successfull';
        return suc;
    }

    public static string secondCall(Integer a2,Integer b2,String c2) {
        Integer aa = a2;
        Integer bb = b2;
        String cc =  c2;
        String URL3 = 'https://ev.mop.com:8080/graze/v1/addSituationCustomInfo?auth_token='+cc+'&sitn_id='+bb+'&custom_info={incrf:'+aa+'}';
        HttpResponse resT = HTTPCallout(URL3, 'POST');
        System.debug('Response from Code request: ('+resT.getStatusCode()+')'+resT.getBody());

        if(resT.getStatusCode()>299) {
            String error = 'Request failed error.HTTP Code = '+resT.getStatusCode()+
                        '. Message: '+resT.getStatus()+'. Response Body: '+resT.getBody();
            System.debug('##### Failed: '+error);
            return error;
        }

        String suc ='successfull';
        return suc;
    }

    public Static HttpResponse HTTPCallout(String EndPoint, String Method) {
        Http h = new Http();
        HttpRequest req= new HttpRequest();
        req.setEndpoint(EndPoint);
        req.setMethod(Method);
        HttpResponse res = null;
        res = h.send(req);
        return res;
    }
}

User-added image
  • December 12, 2015
  • Like
  • 0
Hi Community,

I am trying to do callout but i am getting the below error.
Only top-level class variables can be declared static Line 39
I know there are lots of other error too as I am beginer. Please help me with the below code
Thanks
global class Moogsoft {
    
    @future (callout=true)
    public static void getMoog(String inc,String moog)
    {
        
        String authT = getAuth();
        system.debug('####'+authToken);
        String firstC = updateMoog1(inc,moog,authToken);
        system.debug('####'+firstC);
        String secondC = updateMoog2(inc,moog,authToken);
        system.debug('####'+secondC);
    }
    
    public static string authToken()
    {
    String URL1 = 'https://events5.hclmtaas.com:8080/graze/v1/authenticate?username=graze&password=graze';
    HttpResponse resData = HTTPCallout(URL1, 'GET');   
    System.debug('Response from Moog: ('+resData.getStatusCode()+')'+resData.getBody());    
    if(resData.getStatusCode()>299) {
     String error = 'Failed getting a request token. HTTP Code = '+resData.getStatusCode()+
                      '. Message: '+resData.getStatus()+'. Response Body: '+resData.getBody();
     system.debug('failed'+error);
    }
     else{
     JSONParser parser = JSON.createParser(resData.getBody());
      while (parser.nextToken() != null) {
      if (parser.getCurrentToken() == JSONToken.FIELD_NAME){  
       String fieldName = parser.getText();
        parser.nextToken();
        if(fieldName == 'auth_token' ) {
        authToken = parser.getText();
        system.debug('++++++++++'+authToken);
            
        }
                    return authtoken;
    }
    
    public static string firstCall(String a1,String b1,String c1)
    {
        String URL2 = 'abcd.com';
        HttpResponse res = HTTPCallout(URL2, 'POST'); 
        System.debug('Response from Code request: ('+res.getStatusCode()+')'+res.getBody());
        if(res.getStatusCode()>299)
        {
           String error = 'Failed from moog.HTTP Code = '+res.getStatusCode()+
                      '. Message: '+res.getStatus()+'. Response Body: '+res.getBody();
             System.debug('##### Failed: '+error);
            return error;
        }
        else{
            return null;
        }
    }
          
        public static string secondCall(String a2,String b2,String c2)
        {
            
            String URL3 = 'qrws.com';
            HttpResponse resT = HTTPCallout(EP2, 'POST'); 
            System.debug('Response from Code request: ('+resT.getStatusCode()+')'+resT.getBody());
        if(resT.getStatusCode()>299)
        {
           String error = 'Failed from moog.HTTP Code = '+resT.getStatusCode()+
                      '. Message: '+resT.getStatus()+'. Response Body: '+resT.getBody();
             System.debug('##### Failed: '+error);
            return error;
        }
        else{
            return null;
        }
            
            
        }
        
        
    public Static HttpResponse HTTPCallout(String EndPoint, String Method) {
         Http h = new Http();
         HttpRequest req= new HttpRequest();
         req.setEndpoint(EndPoint);
         req.setMethod(Method);         
         HttpResponse res = null;        
         res = h.send(req);
         return res;
     }
        
        

}


 
  • December 09, 2015
  • Like
  • 0
Hi
Please help me with Attempt to de-reference a null object,how can i resolve this issue
Error is in expression '{!doGeneration}' in page updateincidentremelaptime: Class.GenerateRemainingElapsedTime.doGeneration: line 63, column 1
Below is the sample code(controller) and VF page
Public Class GenerateRemainingElapsedTime{
    public List<BMCServiceDesk__Incident_Service_Target__c> listIncidentServiceTarget{get;set;}
    public Boolean IsGenerated{get;set;}
    Public GenerateRemainingElapsedTime(){
        IsGenerated=false;    
        listIncidentServiceTarget=
                      [SELECT Id, BMCServiceDesk__FKIncident__r.Owner_new__c, BMCServiceDesk__FKIncident__r.Summary__c, Name, BMCServiceDesk__ElapsedTime__c, BMCServiceDesk__FKIncident__r.PendingStartTime__c, BMCServiceDesk__FKIncident__r.PendingDuration__c, BMCServiceDesk__TimeRemaining__c, BMCServiceDesk__StateValue__c, BMCServiceDesk__StartDate__c, BMCServiceDesk__Support_Hour_Applied__c, BMCServiceDesk__PausedDuration__c, BMCServiceDesk__TargetEndDate__c, BMCServiceDesk__FKIncident__r.Status_picklist__c ,BMCServiceDesk__FKIncident__r.Name, BMCServiceDesk__FKIncident__c FROM BMCServiceDesk__Incident_Service_Target__c 
                      WHERE                         
                      BMCServiceDesk__TargetType__c ='ResolutionTime'  AND 
                      BMCServiceDesk__IsCanceled__c = false AND  
                      BMCServiceDesk__StateValue__c <> 'Canceled' AND
                      BMCServiceDesk__FKIncident__r.Status_picklist__c IN ('Assigned','In Progress', 'Pending') AND
                      createddate > 2015-10-29T00:00:00.000Z];    
        System.Debug('####Controller-listIncidentServiceTarget: '+listIncidentServiceTarget);                      
    }
    //Format Date As String
    Public String formatMS(Long timeInMilliSeconds){
            Long seconds = timeInMilliSeconds / 1000;
            Long minutes = seconds / 60;
            Long hours = minutes / 60;
            Long days = hours / 24;
            String timeF = days + ' day(s) ' + AppendZero(Math.mod(hours,24)) + ':' + AppendZero(Math.mod(minutes,60)) + ':' + AppendZero(Math.mod(seconds,60))+' HH:MM:SS'; 
            return timeF ;
    }
    Public String AppendZero(Long num){
            String timeF;
            if(num<10){
                timeF='0'+num;
            }else{
                timeF=''+num;
            }
            return timeF ;
    }
    
    //Method Call
    Public PageReference doGeneration(){
            //Get Incident Service Target        
            listIncidentServiceTarget=
                      [SELECT Id, Name, BMCServiceDesk__FKIncident__r.Owner_new__c, BMCServiceDesk__FKIncident__r.Summary__c, BMCServiceDesk__ElapsedTime__c, BMCServiceDesk__FKIncident__r.PendingStartTime__c, BMCServiceDesk__FKIncident__r.PendingDuration__c, BMCServiceDesk__TimeRemaining__c, BMCServiceDesk__StateValue__c, BMCServiceDesk__StartDate__c, BMCServiceDesk__Support_Hour_Applied__c, BMCServiceDesk__PausedDuration__c, BMCServiceDesk__TargetEndDate__c, BMCServiceDesk__FKIncident__r.Status_picklist__c ,BMCServiceDesk__FKIncident__r.Name, BMCServiceDesk__FKIncident__c FROM BMCServiceDesk__Incident_Service_Target__c 
                      WHERE                         
                      BMCServiceDesk__TargetType__c ='ResolutionTime'  AND 
                      BMCServiceDesk__IsCanceled__c = false AND  
                      BMCServiceDesk__StateValue__c <> 'Canceled' AND
                      BMCServiceDesk__FKIncident__r.Status_picklist__c IN ('Assigned','In Progress', 'Pending') AND
                      createddate > 2015-12-05T00:00:00.000Z];
           IsGenerated=true;
           System.Debug('####Controller-listIncidentServiceTarget: '+listIncidentServiceTarget);    
           for(BMCServiceDesk__Incident_Service_Target__c ist : listIncidentServiceTarget){
               System.Debug('####Controller-ist: '+ist );    
                if(ist.BMCServiceDesk__StartDate__c!=null && ist.BMCServiceDesk__TargetEndDate__c !=null){
                    DateTime startDate= ist.BMCServiceDesk__StartDate__c  ;
                    DateTime endDate= ist.BMCServiceDesk__TargetEndDate__c ;
                    //Total Time
                    Long totalTime=BusinessHours.diff(ist.BMCServiceDesk__Support_Hour_Applied__c, startDate, endDate);
                    //Elapsed Time
                    Long elapsedTime=BusinessHours.diff(ist.BMCServiceDesk__Support_Hour_Applied__c, startDate, DateTime.Now());
                    //Remaining Time
                    Long remainingTime;
                    String fRemainingTime;
                    if(ist.BMCServiceDesk__FKIncident__r.Status_picklist__c=='Pending'){
                        //Dynamic Calculation
                        //Decimal pendingTime=BusinessHours.diff(ist.BMCServiceDesk__Support_Hour_Applied__c, ist.BMCServiceDesk__FKIncident__r.PendingStartTime__c, DateTime.Now());
                        Long pendingTime=(ist.BMCServiceDesk__FKIncident__r.PendingDuration__c).longValue()+BusinessHours.diff(ist.BMCServiceDesk__Support_Hour_Applied__c, ist.BMCServiceDesk__FKIncident__r.PendingStartTime__c, DateTime.Now());
                        elapsedTime=elapsedTime-pendingTime;
                        remainingTime=BusinessHours.diff(ist.BMCServiceDesk__Support_Hour_Applied__c,ist.BMCServiceDesk__FKIncident__r.PendingStartTime__c, endDate);  
                        fRemainingTime=formatMS(remainingTime);
                                             
                    }else{
                        //Static Calculation
                        elapsedTime=elapsedTime-(ist.BMCServiceDesk__FKIncident__r.PendingDuration__c).longValue();
                        if(DateTime.Now()>endDate){
                        //remainingTime=elapsedTime-totalTime;
                        remainingTime=BusinessHours.diff(ist.BMCServiceDesk__Support_Hour_Applied__c, endDate, DateTime.Now());  
                        fRemainingTime='- '+formatMS(remainingTime);  
                        }else{
                            //remainingTime=totalTime-elapsedTime;
                            remainingTime=BusinessHours.diff(ist.BMCServiceDesk__Support_Hour_Applied__c, DateTime.Now(), endDate);  
                            fRemainingTime=formatMS(remainingTime);                            
                        }
                    }                 
                    String fElapsedTime=formatMS(elapsedTime);
                    
                    System.debug('####----------------Incident Number: '+ist.BMCServiceDesk__FKIncident__r.Name+' Status: '+ist.BMCServiceDesk__FKIncident__r.Status_picklist__c);
                    System.debug('####Total Time: '+totalTime);
                    System.debug('####Elapsed Time: '+fElapsedTime);
                    System.debug('####Remaining Time: '+fRemainingTime);      
                    
                    ist.BMCServiceDesk__ElapsedTime__c=fElapsedTime;
                    ist.BMCServiceDesk__TimeRemaining__c=fRemainingTime;                 
                    
                }
        }
        return null;
         
    }

    public PageReference CreatePDF(){
      PageReference pageRef = new PageReference('/apex/RemElapPDF');
      pageRef.setRedirect(false);
      return pageRef;  
    }
     

}
 
<apex:page tabStyle="BMCServiceDesk__Incident_Service_Target__c" controller="GenerateRemainingElapsedTime">
 <style type="text/css">         
        .btnCSS {    
            padding:3px;
            margin:2px 2px 0 2px;
            font: bold 13px Arial, Helvetica, sans-serif;
            width:90px;        
            -moz-border-radius  : 2px; 
            -webkit-border-radius: 2px;            
            cursor:pointer;
            text-decoration: none !important;
            background:   #8C004C;
            background-color:#8C004C;
            border: 1px solid #8C004C;  
            color:#FFF!important;
            
        }
        .btnCSS:hover { 
            text-decoration: none !important;
            background:   #8C004C;
            background-color:#8C004C;
            border: 1px solid #8C004C;  
            color: #FFF!important;
        }
 </style>          
  <apex:sectionHeader title="Generate Remaining/Elapsed Time" help="https://help.salesforce.com/htviewhelpdoc?err=1&id=admin_transfer.htm&siteLang=en_US" />
  This screen allows you to generate Remaining/Elapsed Time of Incident Service Target of <b>Assigned</b>, <b>In Progress</b> and <b>Pending</b> incidents.
  <apex:form id="frm">        
      <apex:pageMessages />
      <apex:actionFunction status="asRefresh" action="{!doGeneration}" name="doGeneration" reRender="oPanel,oPanel1"/>      
      <apex:pageBlock id="pB" mode="maindetail">
        <apex:pageBlockButtons location="top" >
            <button title="Generate" type="button" class="btnCSS" onclick="doGeneration();">Generate</button> 
            <apex:outputPanel id="oPanel1">                   
            <apex:commandLink rendered="{!IsGenerated}"   title="Download in XLS" value="Download in XLS" styleClass="btnCSS" action="{!CreatePDF}"/>   
            </apex:outputPanel>        
             <apex:actionstatus id="asRefresh">
                <apex:facet name="start">
                      <img style="margin-bottom:-3px;margin-top:5px;float:right" src="/img/loading.gif" title="Please Wait..." />
                </apex:facet>
            </apex:actionstatus>       
        </apex:pageBlockButtons>   

        <apex:outputPanel id="oPanel">
        <apex:variable value="{!0}" var="rowNum" />
         <apex:pageBlockSection title="Remaining/Elapsed Time to be generated for below Incident Service Target"  collapsible="false" columns="1">  
              <apex:pageBlockTable value="{!listIncidentServiceTarget}" var="t">
                  <apex:column headerValue="#">
                    <apex:outputText value="{!rowNum + 1}"/>                  
                     <apex:variable var="rowNum" value="{!rowNum + 1}"/>
                  </apex:column>                  
                  <apex:column headerValue="Incident">
                      <apex:outputLink target="_blank" value="/apex/BMCServiceDesk__incidentConsole?record_id={!t.BMCServiceDesk__FKIncident__r.Id}" >{!t.BMCServiceDesk__FKIncident__r.Name}</apex:outputLink>
                  </apex:column>
                  <apex:column headerValue="Incident Service Target">
                      <apex:outputLink target="_blank" value="/{!t.Id}" >{!t.Name}</apex:outputLink>
                  </apex:column>                 
                  <apex:column headerValue="Queue" value="{!t.BMCServiceDesk__FKIncident__r.Owner_new__c}"/> 
                  <apex:column headerValue="Status" value="{!t.BMCServiceDesk__FKIncident__r.Status_picklist__c}"/>                  
                  <apex:column headerValue="Summary" value="{!t.BMCServiceDesk__FKIncident__r.Summary__c}"/>
                  <apex:column headerValue="Elapsed Time" rendered="{!IsGenerated}" value="{!t.BMCServiceDesk__ElapsedTime__c}"/>
                  <apex:column headerValue="Remaining Time" rendered="{!IsGenerated}"  value="{!t.BMCServiceDesk__TimeRemaining__c}"/>
                  
              </apex:pageBlockTable>
          </apex:pageBlockSection>
          </apex:outputPanel>  
      </apex:pageBlock> 
  </apex:form>     
</apex:page>

Please help me with this. :)
 
  • December 06, 2015
  • Like
  • 0
I want to integrate my salesforce org with a tool named Moogsoft . Whenever a record is created at my end.
 I have to update the other environment(moogsoft) using the below URL
https://etamtsvpmoogdv01:8080/graze/v1/addSigCorrelationInfo?auth_token=cc63c187531b46e3a2abfa716a34bc74&sitn_id=<situation_id>&service_name=Remedyforce&resource_id=<RF_ticket_id>

auth_token
in above URL can be fetched using the below link
https://etamtsvpmoogdv01:8080/graze/v1/authenticate?username=graze&password=graze
This link returns auth_token

situation_id : It is one of the field at my end(at salesforce side)

RF_ticket_id : the name/serial number of the record that is created at salesforce side.


Please let me know how this can be done ,if any more information is required please let me know.

Thanks alot :)



 
  • November 26, 2015
  • Like
  • 0

Hi,

I get that error when I try to save this code.

trigger ExampleTrigger2 on Contact (after insert, after delete) {
    if (Trigger.isInsert) {
        Integer recordCount = Trigger.New.size();
        // Call a utility method from another class
        EmailManager.sendMail('aschor@acmeunited.com', 'Trailhead Trigger Tutorial', 
                    recordCount + ' contact(s) were inserted.');
    }
    else if (Trigger.isDelete) {
        // Process after delete
    }
}

thanks,
 

Aron