• Monishan M
  • NEWBIE
  • 10 Points
  • Member since 2020

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

I have written below trigger. But I am not getting any value in the query list. The issue occurs when I give Account_vod__r.country_code_az__c IN :CountryCodes. Can you please let me know why this occurs?

trigger UpdateTA on Survey_Target_vod__c (after update) {

Management_Setting__c AZMEE =Management_Setting__c.getOrgDefaults();
List<String>Countrycodes = new List<String>();
If(AZMEE.Spkr_Therapy_Areas__c!=null){

List<String>Countrycodes = AZMEE.Spkr_Therapy_Areas__c.split(';');
system.debug('hello' +Countrycodes);

}


List<Survey_Target_vod__c> relatedsurveytarget = [SELECT Id,Therapy_Area__c,Submitted_DateTime_vod__c,Name,Account_vod__c,Survey_vod__r.Product_vod__c,Segment_vod__c,
                                                   Survey_vod__c,LastModifiedDate,Survey_vod__r.Detail_Group_vod__c,
                                                   Survey_vod__r.Product_Metric_AZ__c,Survey_vod__r.Product_Metric_AZ__R.Field_Name_AZ__c FROM Survey_Target_vod__c
                                                   WHERE id IN :Trigger.New and Status_vod__c ='Submitted_vod' 
                                                   and Survey_vod__r.Profiling_Survey_AZ_RU__c=True and Survey_vod__r.Profiling_Type_AZ__c='Question Score Based'
                                                   and Account_vod__r.Country_Code_AZ__c IN :Countrycodes
                                                   
                                                    ];
                                                                                                      
                                                    
system.debug('countrylist' +relatedsurveytarget);

The List relatedsurveytarget is empty when checked in debug logs. But i have a record which satisfies all the above condition but still not getting fetched in this query.

Thanks
Hi,
I have built below formula to check certain condition before updating record via process builder.  But not working as expected.
I need to check if the value entered in a text field is exactly matching with my predefined value.

Need to check if response_vod__c is exactly equal to CARD along with certain other conditions

Formula :
AND(CONTAINS([QResponse__c].Test_vod__r.Account_vod__r.Country__c , $Setup.Setting__c.Skr__c ) , NOT(ISBLANK([QResponse__c].Test_vod__r.Survey_vod__r.Product__c)),ISPICKVAL([QResponse__c].Test_vod__r.Survey_vod__r.Status_vod__c , 'Submitted_vod'),[QResponse__c].Response_vod__c =  "CARD" )

Can you please help me in redefining this formula.

Thanks
Hi ,

I have written below validation rule to prevent submitting a record.
Status is a picklist field.

AND(ISPICKVAL(Status_vod__c, 'Submitted_vod'))

When user clicks submit button the above rule should fire and display error message.

But this is not happening. Validation error is not getting displayed and the record is also not getting submitted.

Can you please help me on this

Thanks
Hi,

I have below values in a string

String s1 = ' __valuesE-123456yes__'
String s2 = '__values2E-234567fail__'

I need to fetch only the values starting from 'E- to the next 6 digit values from the strings
Ouptut should be like : E-123456
E-234567

Can you please let me know how to achieve this?

Thanks
Hi All,

Below is my piece of code.
String val[];
 String response = ' false ; My name is XXX' ,
Map<Ids, String > miverr = new Map<Ids , String >() ;


val =  response.split(';');

if (val[0] == 'true') {
                 {
                    submittedInquiries = Done
                }
               
            else {
                
               thisMI = a00123456rtg4h57;
                miverr.put(thisMI,val[1]);

}

Problem is if the Val[1] becomes null in some cases, exception is being thrown.

Example: List index out of bound except at lin 18 column 81.....

Can you please let me know how to handle this.

Thanks,
Monisha
              
 
Hi All,

I have below code, when executing receiving the error

System.QueryException: unexpected token: Id

Code
global class RetrieveMedicalInquiryStatusBatchMVN implements Database.Batchable<sObject>, Database.AllowsCallouts, Database.Stateful, Schedulable {

    String query = 'SELECT Id,Account_vod__c, Status_vod__c, MA_Response_AZ__c ' +
                    // Query Closing
                    'FROM Medical_Inquiry_vod__c ' +
                    'WHERE Sent_to_GMIP_MVN__c = TRUE ' +
                    'AND Status_vod__c IN :statuses' +
                    'AND Id IN :Ids';

    List <String> statuses;
    List<String>Ids = new List<String>{'a0t1y0000005QRTAA2','a0t1y0000005QRYAA2'};

Can you please let me know how to correct them

Thanks,
Monisha
Hi All,

I am receiving above error in below code
global class RetrieveMedicalInquiryStatusBatchMVN implements Database.Batchable<sObject>, Database.AllowsCallouts, Database.Stateful, Schedulable {

    String query = 'SELECT Id,Account_vod__c, Status_vod__c, MA_Response_AZ__c ' +
                    // Query Closing
                    'FROM Medical_Inquiry_vod__c ' +
                    'WHERE Sent_to_GMIP_MVN__c = TRUE ' +
                    'AND Id IN :Ids';

    List <String> statuses;
    List<String> Ids = new List<String>('a0tU000000784Gbdue' , 'a0tU00000090WERThc') ;

Can you please help me in sorting this out

Thanks,
Monisha
Hi All,

I am receiving the below error when running my Apex class

System.ListException: List index out of bounds: 1
Class.SubmitMedicalInquiryBatchMVN.execute: line 419, column 1

Below is the code piece where error is occuring 
      // Send Request
           
            //Boolean response = mirSubmission.fetchMISubmitResponse();
            String response = mirSubmission.fetchMISubmitResponse();
        
            val =  response.split(';');
          //  system.debug('value kk : ' +val[1]);
    //miverr =  new Map<Medical_Inquiry_vod__c , String >();
            if (val[0] == 'true') {
                system.debug('inside true kk');
                if (submittedInquiries == null) {
                    submittedInquiries = new List <MedicalInquirySubmissionMVN>();


The  fetchMISubmitResponse() method called from another Apex class:
The code piece is as below

 Method to parse the response and set the objects appropriately
*/
    public String fetchMISubmitResponse(){
        //String sReq = getMISubmitRequest();
        String sReq = getMISubmitRequestv2();
   
        
      String sResponse = SOAPServiceUtilityMVN.getSOAPResponse(EndPoint, sReq);
       
        integer count = sResponse.countMatches('<urn:description>');
        
        
        String[] value = sResponse.split('<urn:description>');
        String resdec  = '' ;
        for(integer i = 0 ; i < value.size() ; i++)
        {   
            System.debug('++++Value[i]'+Value[i]);
            if((value[i]).contains('</urn:description>'))
            {
                if(resdec !='') {
                    resdec +=','+ value[i].substringbefore('</urn:description>');
                    System.debug('value of str inside : ' +resdec); 
                }
                else {
                    resdec = value[i].substringbefore('</urn:description>');
                    System.debug('value of str inside : ' +resdec); 
                }
                
                
            }
        }
        System.debug('value of str out : ' +resdec);
        //String sResponse = '<urn:description> Origin country Code is Empty</urn:description>' ;
        //String resdec = sResponse.substring(sResponse.indexOf('<urn:description>') +17 , sResponse.indexOf('</urn:description>'));
        
        system.debug ('Response value from mule service kk : ' + resdec);
        
        
        // sResponse will SOMETIMES reavel the SOA Service password. If it does, destroy it for the debug.
        if (sResponse.contains(credentials.Password_MVN__c)) {
            
        } else {
            
        }
        
        DOM.Document doc = new DOM.Document();  
        try {
            doc.load(sResponse);
            DOM.XMLNode root = doc.getRootElement();
            DOM.XmlNode xBody = SOAPServiceUtilityMVN.getFirstChildElementByName(root, 'Body');
            DOM.XmlNode xFault = SOAPServiceUtilityMVN.getFirstChildElementByName(xBody, 'Fault');
            system.debug('value if xFault kkf : ' +xFault);
            DOM.XmlNode xException = null;
            for(DOM.XmlNode xNode:SOAPServiceUtilityMVN.getFirstChildrenOfLevel(xBody, 1)){
                if(xNode.getName() == 'exceptions'){
                    xException = xNode;
                    system.debug('value of Exception kke :' +xException);
                }
            }
            // Something failed in the SOA layer
            if(xFault != null || xException != null){
                return 'false' + ';' + resdec ;
            }
            else{
                String status = '0';
                InteractionStatus = new MedicalInquiryMVN.InteractionStatus();
                // Parse the response on submitting the AE to Jasper
                for(DOM.XmlNode xNode:SOAPServiceUtilityMVN.getFirstChildrenOfLevel(xBody, 2)){
                    if(xNode.getName() == 'statusMessage'){
                        InteractionStatus.StatusMessage = xNode.getText();
                    }
                    else if(xNode.getName() == 'submissionStatus'){
                        InteractionStatus.SubmissonStatus = xNode.getText();
                    }
                }
                
                if(InteractionStatus.SubmissonStatus == 'FAILED')
                {
                    system.debug('value mvnclass 298: ' +resdec);
                    return 'false' + ';' + resdec ;
                }
                else{
                    return 'true' + ';' + resdec ;
                }
                
            }
            system.debug('value mvnclass 306 : ' +resdec);
            return 'false' + ';' + resdec ;
        } catch (System.XMLException e) {  // invalid XML
            System.Debug('exception message : line 309 :' +e.getMessage());
            return 'false' + ';' + e.getMessage() ;
        }       
        return 'false' + ';' + resdec ;
    }   
}
                }
                submittedInquiries.add(mirSubmission);
            } else {
                system.debug('inside false');
                if (failedMIRSubmissions == null) {
                    failedMIRSubmissions = new List <Medical_Inquiry_vod__c>();
                }
                failedMIRSubmissions.add(thisMI);
                miverr.put(thisMI,val[1]);--------> error is occuring in this line
                system.debug('miverr value : ' +miverr);
            }
        }

Can you please help me in avoiding this error?

Thanks
Hi ,

I need to update a field in Master object based on values in field in Detail object.

When an email(master object) is sent , and actioned then a corresponding Email action (detail object) will be created for the master record.

Now based on a value in the detail record I need to update a field in the master record every time.

Can this be done via workflow or Process builder?
Can you please suggest the best way and how this can be achieved

Thanks

 
Hi,

I am trying to fetch Accounts with First Name contains "SA" but I am receiving the below error 
Too many query rows: 50001
Error is in expression '{!doSearch}' in component <apex:commandButton> in page searchaccts: Class.GASUtilities.getMatchingAccountIds: line 65, column 1
Class.GASUtilities.getAccountIdsToExclude: line 30, column 1
Class.searchAccts.excludeAccountsIfAny: line 969, column 1
Class.searchAccts.doSearch: line 528, column 1

Could you please guide me what should be done to eliminate this error?


Below is my Apex  code piece as per the above error lines

Class.searchAccts.excludeAccountsIfAny: line 969, column 1

Set<ID> idsToIncludeExclude = GASUtilities.getAccountIdsToExclude(UserInfo.getUserId(), accountIds); 
        //mnaidu - 1/9/2014 - check to see if the filters are supposed to be retain the filter results
        // or exclude the filter results from the general unfiltered search
        Boolean retain = (GAS_Hierarchical_Setting__c.getInstance().Enable_CB_Filter_Retain_Mode__c == null) 
                                    ? false : GAS_Hierarchical_Setting__c.getInstance().Enable_CB_Filter_Retain_Mode__c ;
        if(retain && (idsToIncludeExclude == null || idsToIncludeExclude.size() == 0)){
            //no accounts should be shown
            accountIds.clear();
            return accountIds;
        }
        if(idsToIncludeExclude!=null && idsToIncludeExclude.size() > 0){
            originalAcctIds.addAll(accountIds);
            if(retain){
                originalAcctIds.retainAll(idsToIncludeExclude);
            }
            else{
                originalAcctIds.removeAll(idsToIncludeExclude);
            }
            
            accountIds.clear();
            accountIds.addAll(originalAcctIds);
        }
        return accountIds;
    }


Class.searchAccts.doSearch: line 528, column 1  if(GAS_Hierarchical_Setting__c.getInstance().Do_Criteria_Based_Filtering__c){
                acctIds = excludeAccountsIfAny(acctIds);
            }
           // Error if nothing found
            if (acctIds.size() == 0) {
                ApexPages.addMessage (new ApexPages.Message(ApexPages.Severity.WARNING, GAS_NOMATCH));
                return null;
            }

Thanks
Hi,

I have below query built. But this query fetches even the suggestion_vod__c records which doesnt have suggestion_tags_vod__c records.

I need to fetch only the suggestion_vod__c records which have suggestion_tags_vod__c records. I need to eliminate the suggestions which doesnt have suggestion tags.

Could you please help me in the query

For(Suggestion_vod__c S :[Select  id,account_vod__c,Expiration_Date_vod__c ,OwnerId,Created_Based_on_CVMD_Respi_AZ_JP__c,
 Marked_As_Complete_vod__c,Patients_ID_AZ_JP__c,Dismissed_vod__c,Created_Based_on_Cycle_Plan_Rule_AZ_JP__c,
 (Select id,Product_vod__c,Suggestion_vod__c from Suggestion_Tags_vod__r) 
 from suggestion_vod__c 
  where Expiration_Date_vod__c >= Today 
   AND Marked_As_Complete_vod__c = Null 
   AND Dismissed_vod__c = Null

Suggestion_tag_vod__c object has a master detail relationship with Suggestion_vod__c object.
Hi,

I need to find difference between a date field and todays date and check if its equal to exact 60 days.

I used the below statement in code bt its throwing error as 
"Invalid field 60 for object "
Statement:
if(60==Integer.ValueOf(Date.valueof(startdate).daysBetween(System.today())))

Could you please let me know how to achieve this?

Thanks
 
Hi,

I need to compare two dates- 
created date of a record and current date.

At exactly 2months after the record created date I need to alert the user.
Can anyone let me know how to compare two dates and know if it has passed exactly 60 days?

Thanks
 
Error: FATAL_ERROR System.QueryException: unexpected token: AZ_lyn_prescription_AZ_JP__c

  global Database.QueryLocator start(Database.BatchableContext BC) {
        
        // Fetch last run from Cutom setting 
        AZM_Settings_AZ_JP__c objSetting = AZM_Settings_AZ_JP__c.getOrgDefaults();
        Datetime lastSync = objSetting.Clear_Suggetsions_Last_Run_time_AZ_JP__c;
        if(lastSync == null ){
            lastSync = System.Now();
        }
        
        String query = 'SELECT Id,AZ_Product_Catalog_AZ_JP__c,AZ_lyn_prescription_AZ_JP__c,AZ_Product_Catalog_AZ_JP__c,Delete_AZ_JP__c,Recordtype.name,Dose_Status_AZ_JP__c,AZ_HCP_AZ_JP__c,CreatedDate,Lastmodifieddate FROM AZ_Patient_Information_AZ_JP__c' + 
                       'WHERE AZ_lyn_prescription_AZ_JP__c = \'Yes\'' +
                       'AND Lastmodifieddate >= '+lastSync.formatGMT('yyyy-MM-dd\'T\'HH:mm:ss.SSS\'Z\'');  
                         System.debug(query);        
                         return Database.getQueryLocator(query);
                         }

Can anyone please help me in this?
Hi All,

Below is my piece of code.
String val[];
 String response = ' false ; My name is XXX' ,
Map<Ids, String > miverr = new Map<Ids , String >() ;


val =  response.split(';');

if (val[0] == 'true') {
                 {
                    submittedInquiries = Done
                }
               
            else {
                
               thisMI = a00123456rtg4h57;
                miverr.put(thisMI,val[1]);

}

Problem is if the Val[1] becomes null in some cases, exception is being thrown.

Example: List index out of bound except at lin 18 column 81.....

Can you please let me know how to handle this.

Thanks,
Monisha