• roni shore
  • NEWBIE
  • 160 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 40
    Questions
  • 40
    Replies
Hi Guys,
can anyone pls suggest how to get a certain value from nested list<map's>
 List<Map<String,Object>> newl =  new List<Map<String,Object>>();
                         for(Object itrObj : l){
                             newl.add((Map<String, Object>)itrObj); // got all records here
//how to get certain values from the collection
                             
                             system.debug('id val==>'+ newl);
                         }
               
Hi Guys,
I have written a rest api , get callout class to fetch the Bulk load job, using '/services/data/v45.0/jobs/ingest/'. This provides all the id with details of bulk jobs in JSON format.
I need to fetch the failedrecords from each of the loads, but that requires to pass Id's dynamically in the url (like: /services/data/v45.0/jobs/ingest/jobId/failedRecords ), can someone pls suggest how to do that
Hi Guys,
can I get the details of Bulk upload jobs? I see in docs we can use REST API to get the Id and details like "/services/data/v45.0/jobs/ingest".
Is it possible to programmatically use this to fetch the number of records failed?
 
Hi Guys -can someone please suggest, how we can activate and deactivate workflows through metadata api in Apex
Hi Guys- can anyone help out on this, I want to schedule a batch so it runs thrice at 23:00, 1:40 & 4:00

String cronStr = '0 45 23,1,4 * * ?';

Hours I can specify comma seperated but minutes it's not taking, pls suggest
Scenario: when a lead is created, then 2 sibling leads are created, now we convert one of the sibling lead and we get a realted contact. 
problem -So, can i fetch a field values of a converted lead and then populate it in another sibling lead

m trying with below code, isnt helping..please suggest

 public static void updateRelContactAfter(list<Contact> lstNewContact)  {
        
        
          System.debug('lstNewContact===>'+lstNewContact);
             set<String> setEmail = new set<String>();
             map<String,Contact> mapLead = new map<String,Contact>();
             for(Contact c:lstNewContact){
                 setEmail.add(c.Email);
                 mapLead.put(c.Email,c);
             } 
             System.debug('mapLead===>'+mapLead);
             Id salesRTID = RecordTypeManager.getRecordTypeId('Lead.Sales_Marketing');
             List<Lead> leadList = [SELECT Id,RelatedContact__c,Email,RecordTypeId FROM Lead 
                                     WHERE Email IN:setEmail AND RecordTypeId =:salesRTID AND IsConverted != True];
             system.debug('LeadList===>'+ leadList);                        
             list<lead> leadUpdateList = new list<lead>();                        
             for(Lead l:leadList){
                 lead lnew = new lead();
                 lnew.id = l.id;
                 lnew.Related_existing_Contact__c = mapLead.get(l.email).Id;
                 system.debug('checkpnt===>'+ lnew.Related_existing_Contact__c);
                 leadUpdateList.add(lnew);
             }  
             System.debug('leadUpdateList===>'+leadUpdateList);
             if(leadUpdateList != null){
                 update leadUpdateList;
                 System.debug('leadUpdateList==After=>'+leadUpdateList);
             }                                   
         }
    
Hi Guys - how to populate lastmodifiedby on a custom text filed using trigger on customobj__c. please suggest
I have a scenario. Unable to assign value to dummy variable. pls suggest
           
             String dummyVal;
             dummyVal = object1.Group_Member__c;
             String dummy;
             dummy = dummyVal.SVM__c;// unable to assign value here
             system.debug('dummy'+dummy);
            
Hi Guys,
I am trying to populate a 2 level record (child) but somehow it is not updating. pls suggest
code
------
inTrans = new Service_Order_Line__c(
                         Service_Order__c = wo.Id,
                         Work_Detail_Auto_Created__c = true,
                         Expense_Type__c = 'TRAVEL',
                         Start_Latitude__c = wo.Group_Member__r.SVC_Latitude__c, // field not populating
                         Start_Longitude__c = wo.Group_Member__r.SVC__Longitude__c // field not populating

                     );
Hi Guys,
getting variable does not exist when checking the old value is null or not. please suggest

 public static Boolean HasAccess(List<AccountContactRelation> lstNew) {
               for (AccountContactRelation acr : lstNew) {
                system.debug('trigOld-->'+trigger.oldMap.get(acr.Id));
                
                    if(string.isNotBlank(acr.Entity__c) || string.isNotBlank(trigger.oldMap.get(acr.Id).External_Entity__c)  ){// getting  error on this line checking oldmap
                    
                        if(acr.External_Entity__c != 'Customer-facing')
                            throw new acrException(System.Label.Cimited);
                    }
                }
                  return bReturn;
            }
       
can we use AccountContactRelation refrencing Account object like below
If I use like this I get Error: Compile Error: Variable does not exist: AccountContactRelation

For(AccountContactRelation acr : acc.AccountContactRelation){  // here acc is account var

}

pls suggest

 
If i am using List of ACR object it throwing compoile error
List<AccountContactRelation> acrlist = new List<AccountContactRelation>();

pls suggest
 
 Compile Error: Invalid type: AccountContactRelation
when adding record in list in last line, it throws error, pls suggest

List<AccountContactRelation> lstACR = new List<AccountContactRelation>();// error here
for(AccountContactRelation ACR : [Select Id, AccountId, ContactId, Roles from AccountContactRelation where ContactId =: sConId and 
                                                      AccountId in : accIds and Roles in : mapConRole.values()]) {
                                                          if(ACR.AccountId == opp.Ship__c)  
                                                              bShip = true;
                                                          if(ACR.AccountId == opp.Bill__c) 
                                                              bBill = true;
                                                        
                        }
 if(!bFoundShip)
                            lstACR.add(new AccountContactRelation(AccountId = opp.Ship__c, ContactId = sConId, Roles = sConRole));
Hi Guys - How to Display sections of same VF Component, one on top and other at bottom of page
For eg:
<apex:component>
1st Div- to be positioned top of page
<div>
</div>
2nd Div- to be positoned on bottom of page
<div>
</div>
</apex:component>
Hi - I have created 3 vf component, now I have to render it based on User's Locale

Pls suggest a solution
Hi Guys- I am unable to figure out where these fields are coming from, these aren't in layout too pls suggest

User-added image
Hi guys -  I am using a custom field called custom_dt__c (data type date/time) to calculate the age of record but the formula is showing an incorrect value

FLOOR(NOW()-custom_dt__c)

PLEASE SUGGEST
Hi guys, I am trying to insert community user through but its failing.
Code
====
 @Future  
    public static void createCommunityUser(Set<Id> contactIdSet){
        List<Contact> contactList = [SELECT 
                                           Id,LastName,Email 
                                           FROM Contact 
                                           WHERE Id IN: contactIdSet];
        List<User> userList = new List<User>();
        List<Profile> profileList = [SELECT 
                                            Id 
                                            FROM Profile 
                                            WHERE Name = 'Customer Community User' 
                                            LIMIT 1];
        List<UserRole> roleList = [SELECT 
                                        Id,PortalType
                                        FROM UserRole 
                                        WHERE PortalType = 'None'
                                       ];
                                       
        for(Contact contactObj : contactList){
            User uObj = new User();
            uObj.LastName = contactObj.LastName;
            uObj.ContactId = contactObj.Id;
            uObj.Username = contactObj.Email;
            uObj.Email = contactObj.Email;
            String lstName = contactObj.LastName;
            uObj.ProfileId = profileList[0].Id;
            uObj.UserRoleId = roleList[0].Id;
            uObj.IsActive = true; 
            uObj.TimeZoneSidKey = 'GMT';
            uObj.LanguageLocaleKey = 'en_US';
            uObj.EmailEncodingKey = 'UTF-8';
            uObj.LocaleSidKey = 'en_US';
            uObj.CommunityNickname = contactObj.LastName;
            String identifier = contactObj.Email;
            //uObj.UserType = 'CustomerSuccess';               
            userList.add(uObj);
        }
        try{
            /* Insert the user record */
            Insert userList;  
        }Catch(Exception e){
            System.debug('Error Occured at Community User Creation : '+e.getMessage());
        }   
        System.debug('Community Users ->'+userList);
    }    
   please suggest
Hi guys,
I am using a formula to show an image based on picklist values, its coming correct but if I modify the formula to accommodate one more picklist values the formula saves but doesn't show the image. plz suggest
formula
======
This works fine

CASE(Lost__c,"Old",""&" "&IMAGE((LEFT($Api.Partner_Server_URL_260, FIND('/services',$Api.Partner_Server_URL_260))+"resource/1247929509000/lost"), "False"),NULL)

if one more picklist val added the image doesn't show

CASE(Lost__c,"Old","","Lost-Z6",""&" "&IMAGE((LEFT($Api.Partner_Server_URL_260, FIND('/services',$Api.Partner_Server_URL_260))+"resource/1247929509000/lost"), "False"),NULL)
 
Public Class Customer_Controller{
    
    ApexPages.StandardController controller;
     @TestVisible private final Case thisCase;

    public Customer_Controller(ApexPages.StandardController controller) {
        this.controller = controller;
        this.thisCase = (Case)controller.getRecord();
    }
    public Boolean isTScase {
        get {
            return (((String)thisCase.RecordTypeId).left(15) == Label.Caseod_RecordType);
        }
    }
    public Boolean isCScase {
        get {
            return (((String)thisCase.RecordTypeId).left(15) == Label.Casenew_recordtype);
        }
    }

error : Compile Error: Variable is not visible:
Scenario: when a lead is created, then 2 sibling leads are created, now we convert one of the sibling lead and we get a realted contact. 
problem -So, can i fetch a field values of a converted lead and then populate it in another sibling lead

m trying with below code, isnt helping..please suggest

 public static void updateRelContactAfter(list<Contact> lstNewContact)  {
        
        
          System.debug('lstNewContact===>'+lstNewContact);
             set<String> setEmail = new set<String>();
             map<String,Contact> mapLead = new map<String,Contact>();
             for(Contact c:lstNewContact){
                 setEmail.add(c.Email);
                 mapLead.put(c.Email,c);
             } 
             System.debug('mapLead===>'+mapLead);
             Id salesRTID = RecordTypeManager.getRecordTypeId('Lead.Sales_Marketing');
             List<Lead> leadList = [SELECT Id,RelatedContact__c,Email,RecordTypeId FROM Lead 
                                     WHERE Email IN:setEmail AND RecordTypeId =:salesRTID AND IsConverted != True];
             system.debug('LeadList===>'+ leadList);                        
             list<lead> leadUpdateList = new list<lead>();                        
             for(Lead l:leadList){
                 lead lnew = new lead();
                 lnew.id = l.id;
                 lnew.Related_existing_Contact__c = mapLead.get(l.email).Id;
                 system.debug('checkpnt===>'+ lnew.Related_existing_Contact__c);
                 leadUpdateList.add(lnew);
             }  
             System.debug('leadUpdateList===>'+leadUpdateList);
             if(leadUpdateList != null){
                 update leadUpdateList;
                 System.debug('leadUpdateList==After=>'+leadUpdateList);
             }                                   
         }
    
Hi Guys - how to populate lastmodifiedby on a custom text filed using trigger on customobj__c. please suggest
Hi Guys,
getting variable does not exist when checking the old value is null or not. please suggest

 public static Boolean HasAccess(List<AccountContactRelation> lstNew) {
               for (AccountContactRelation acr : lstNew) {
                system.debug('trigOld-->'+trigger.oldMap.get(acr.Id));
                
                    if(string.isNotBlank(acr.Entity__c) || string.isNotBlank(trigger.oldMap.get(acr.Id).External_Entity__c)  ){// getting  error on this line checking oldmap
                    
                        if(acr.External_Entity__c != 'Customer-facing')
                            throw new acrException(System.Label.Cimited);
                    }
                }
                  return bReturn;
            }
       
can we use AccountContactRelation refrencing Account object like below
If I use like this I get Error: Compile Error: Variable does not exist: AccountContactRelation

For(AccountContactRelation acr : acc.AccountContactRelation){  // here acc is account var

}

pls suggest

 
If i am using List of ACR object it throwing compoile error
List<AccountContactRelation> acrlist = new List<AccountContactRelation>();

pls suggest
 
 Compile Error: Invalid type: AccountContactRelation
when adding record in list in last line, it throws error, pls suggest

List<AccountContactRelation> lstACR = new List<AccountContactRelation>();// error here
for(AccountContactRelation ACR : [Select Id, AccountId, ContactId, Roles from AccountContactRelation where ContactId =: sConId and 
                                                      AccountId in : accIds and Roles in : mapConRole.values()]) {
                                                          if(ACR.AccountId == opp.Ship__c)  
                                                              bShip = true;
                                                          if(ACR.AccountId == opp.Bill__c) 
                                                              bBill = true;
                                                        
                        }
 if(!bFoundShip)
                            lstACR.add(new AccountContactRelation(AccountId = opp.Ship__c, ContactId = sConId, Roles = sConRole));
Hi Guys- I am unable to figure out where these fields are coming from, these aren't in layout too pls suggest

User-added image
Hi guys -  I am using a custom field called custom_dt__c (data type date/time) to calculate the age of record but the formula is showing an incorrect value

FLOOR(NOW()-custom_dt__c)

PLEASE SUGGEST
Hi guys, I am trying to insert community user through but its failing.
Code
====
 @Future  
    public static void createCommunityUser(Set<Id> contactIdSet){
        List<Contact> contactList = [SELECT 
                                           Id,LastName,Email 
                                           FROM Contact 
                                           WHERE Id IN: contactIdSet];
        List<User> userList = new List<User>();
        List<Profile> profileList = [SELECT 
                                            Id 
                                            FROM Profile 
                                            WHERE Name = 'Customer Community User' 
                                            LIMIT 1];
        List<UserRole> roleList = [SELECT 
                                        Id,PortalType
                                        FROM UserRole 
                                        WHERE PortalType = 'None'
                                       ];
                                       
        for(Contact contactObj : contactList){
            User uObj = new User();
            uObj.LastName = contactObj.LastName;
            uObj.ContactId = contactObj.Id;
            uObj.Username = contactObj.Email;
            uObj.Email = contactObj.Email;
            String lstName = contactObj.LastName;
            uObj.ProfileId = profileList[0].Id;
            uObj.UserRoleId = roleList[0].Id;
            uObj.IsActive = true; 
            uObj.TimeZoneSidKey = 'GMT';
            uObj.LanguageLocaleKey = 'en_US';
            uObj.EmailEncodingKey = 'UTF-8';
            uObj.LocaleSidKey = 'en_US';
            uObj.CommunityNickname = contactObj.LastName;
            String identifier = contactObj.Email;
            //uObj.UserType = 'CustomerSuccess';               
            userList.add(uObj);
        }
        try{
            /* Insert the user record */
            Insert userList;  
        }Catch(Exception e){
            System.debug('Error Occured at Community User Creation : '+e.getMessage());
        }   
        System.debug('Community Users ->'+userList);
    }    
   please suggest
Hi guys,
I am using a formula to show an image based on picklist values, its coming correct but if I modify the formula to accommodate one more picklist values the formula saves but doesn't show the image. plz suggest
formula
======
This works fine

CASE(Lost__c,"Old",""&" "&IMAGE((LEFT($Api.Partner_Server_URL_260, FIND('/services',$Api.Partner_Server_URL_260))+"resource/1247929509000/lost"), "False"),NULL)

if one more picklist val added the image doesn't show

CASE(Lost__c,"Old","","Lost-Z6",""&" "&IMAGE((LEFT($Api.Partner_Server_URL_260, FIND('/services',$Api.Partner_Server_URL_260))+"resource/1247929509000/lost"), "False"),NULL)
 
Hi guys, I have renamed the internal comments standard field on case  object to comments but it still appears on the layout as internal comments.
plz suggest
 
Hi - can anyone please help me with the test class for below, I have written the test class but it's not covering the else block
class
====
public class Comm_Locale { 
   public  User ur = new User();
   public String redirectUrl {get;set;}
   public Comm_Locale(){
   Map<String,global__c> cSetting_Map = Locale_on_Global__c.getAll();
        ur = [Select id, Contact.Locale__c FROM User where Id =: UserInfo.getUserId()];
        if(String.isNotBlank(ur.Contact.Locale__c)){
            global__c  cSettingList = cSetting_Map.get(ur.Contact.Locale__c);  
            if(String.isNotBlank(cSettingList.Account_URL__c)){
                redirectUrl = cSettingList.Account_URL__c;
            }else{
                redirectUrl = 'https//:www.google.com';
            }
        }else{
            // Need to assign default web link if required
            redirectUrl = 'https//:www.google.com';
        }
    }


test class
======
@isTest
private class Comm_Locale_tetd{
   static testMethod void CheckLocale() {
       Global__c log = new Global__c(name = 'test',Account_URL__c = 'https://www.test.com');
       insert log;
       contact con = new contact(LastName = 'test name',Locale__c = 'en_US');
       insert con;
       Comm_Locale pbc = new Comm_Locale ();
     }
Hi Guys - I have written a controller which is being used in an vf component. My issue is I need to display adresses comma seperated.
pls suggest 

controller
------------
public with sharing class DisplayList{ 
    public List<Address__c> Records {get; set;} 
    
    public DisplayList(){ 
    Records = [SELECT Name 
               FROM Address__c
               WHERE Billing_Account__c = :ApexPages.currentPage().getParameters().get('Id')];
    system.debug('record-->'+Records); 
    } 
 }
vf component snippet
=----------------------------
 </apex:repeat>
        <apex:repeat value="{!Records}" var="Record">
         <div><span>Service Addresses:</span><span><apex:outputText value="{!Record.Name}" escape="false"/></span></div>
    </apex:repeat>
 
Hi Guys- I have an custom object "Address__c" related to Account, when passing the account id there I am not getting any records, please suggest

public with sharing class DisplayQueryList{ 
    public List<Address__c> Records {get; set;} 
    public DisplayQueryList(){ 
    Records = [select Id,Name FROM Address__c WHERE Id = :ApexPages.currentPage().getParameters().get('id')];
    system.debug('record-->'+Records); 
    } 
     
}
Hello, I will appreciate your help on this please: 
Need help to understand what I am doing wrong.

In developer intermediate section of trailhead
API Basics: Use bulk API challenge

Import Accounts Using Bulk API and Workbench
Using Bulk API and Workbench, import these account records (a CSV file).

This is what I tried in workbench:

Step 1:  /services/data/XX.0/jobs/ingest
Executed POST

Step 2: /services/data/XX.0/jobs/ingest/jobID/batches
Changed Headers Content-Type to text/csv
"/Users/ediz/Downloads/bulkv2hocdata.csv"
Executed PUT

Step3: /services/data/XX.0/jobs/ingest/jobID. 
In the request body, replaced the text with the following JSON text.
{
   "state" : "UploadComplete"
}

Executed PATCH
 
Trigger failure causes login flow exception. Problem is that I have only one admin user in this development sandbox. Other user has standard user profile and it can be logged in. This other user doesnt have capabilities to deactivate login flow or deactivate trigger causing this error.

I have tried to reset password and it failed too because login flow was activated even in password change.  Is there way to get access back without dumping sandbox and rebuild it from a scratch? Force IDE is not a option because security token is not valid. All help I can get is much appreciated, thanks!