• chaithaly gowda
  • NEWBIE
  • 40 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 28
    Questions
  • 10
    Replies
Hi ,

I am building a community page with the record detail component in it.. in my case opportunity record page, I am a system Admin and when I place that component on the community page, the new button and other standard buttons are missing despite having all permission.
User-added image 
Hi ,

I am facing some issue related to Debug logs , I have set the Apex code to 'Finest' and tried generating the log , but all I see in logs is ' SYSTEM_METHOD_EXIT|' , SYSTEM_METHOD_ENTRY| , I dontt see any variable names/method names.User-added image

Can someone please let me know what could be the issue.
Hi All,

I am trying to authorize my org from VScode, I am currently working in VPN , I am getting timeout error (failed to connect to localhost) ,If I turn off the VPN , things are working fine.,

Can someone please guide if there is any procedure to follow while working in VPN.
Thanks in advance.
Hi

I have applied stripInaccessible in the following query,
SObjectAccessDecision securityDecision = Security.stripInaccessible(AccessType.READABLE,[SELECT Id, Name, IsActive, , ProfileId, UserRoleId,UserRole.Name, Profile.Name, 
            FROM User WHERE Id =: pUserId LIMIT 1]);
            System.debug('Fields removed by stripInaccessible: '+securityDecision.getRemovedFields());
            
In the debug statement I can see Profile.Name and ProfileId are getting stripped. I am not sure check/give the permission to 'Profile Object /Fields. I dont find 'Set FLS ' in fields as well.

Any help is appreciated.

Thanks
.
Hi 

I am running this generic code which is used to return set of ID.

public statset<id>getetIdSet(sObject[] pSobjects, string pSObjField){
        set<Id> sObjIdSet = new set<Id>();
        for(sObject sObj : pSobjects){
            if(pSObjField != null){
                //split reference fields
                string[] refFields = pSObjField.split('\\.');
               
               if(refFields.size() > 1){
                 System.debug(sObj.getSObject(refFields[0]));
                    if(sObj.getSObject(refFields[0]) != null && sObj.getSObject(refFields[0]).get(refFields[1]) != null){                       
                        sObjIdSet.add(string.valueOf(sObj.getSObject(refFields[0]).get(refFields[1])));
                    }
}
return sObjIdSet;
}
getIDset(newContacts, 'reference_field__r.field__c');
System.debug( sObj.getSObject(refFields[0])); this statement is returning NULL even though there is value in both the field.

Can someone please help regarding this issue . how to access parent fields when running from child trigger context.
                   
Hi 

I have a batch class 'TerritoryDetails' which has been scheduled in 'ScheduleTerritoryDetails'.

I have a test class 'TestScheduleTerritoryDetails'
public with sharing class TestLFDTerritoryScheduler {

    @TestSetup
    static void makeData(){
//Testdata created
}

static testmethod void test(){
    Test.startTest();
    ScheduleTerritoryDetails m = new ScheduleTerritoryDetails();
          String hour = '0';
        string minute = '30';
        string sec = '0';
  String sch =  sec+ ' '+ minute+' '+ hour +' '+'* * ?'; 
String jobName = 'Update ';
id jobId = system.schedule(jobName, sch, m);
}


and in scheduler class , the batch class has been called.
TerritoryDetails b = new TerritoryDetails();
database.executeBatch(b, 3); 

but when I execute the test class, it is covering 100% of scheduler class,but  not covering the batch class.
Can someone please help in covering this batch class.
 
Hi

I have a JSON request with following format 
"property":["abc",xyz"]
I have a requirement to store this property contents into a field with separate lines.

Can someone please help me with this.

Thanks
Chaithaly.
Hi

I have a test class for batch class that executes upon the insert of task and event records.

@TestSetup 
    static void CreateData()
    {
        Test.startTest();
     DataFactory.createTasks(3, 'Task Score', 'Not  Started','Operations - Task', true); 
     DataFactory.createEvents(3,'Event ActivityBactchScore','Operations - Event', True);
        Test.stopTest();
    }

static testMethod void TaskBatchTest() {
     //   insert TaskRecords;
     System.debug([Select id,totaljobitems,apexclassid,jobitemsprocessed FROM AsyncApexJob WHERE JobType='BatchApex' and status='completed']);

integer count=[Select count() FROM AsyncApexJob WHERE JobType='BatchApex' and status='completed'];

            system.assertEquals(1, count);
}

So ideally, two times the batch class needs to be executed upon isertion of task and event record.

But if I query asyncapexjob it is returning only one id, and when i checked debug log, the batch class execute method is called only once for task but not for events.

Can someone please let me know why this is happening and also how do i check for event batch execution .

Thanks
Hi

I have to compare the record type id/name using system.assertequals();
Task task = new Task();
            task.Subject = 'Test Send New Task Email Notification';
            task.Status = 'Not Started';
            task.ActivityDate = Date.Today();
            task.Priority = 'Normal';
             task.RecordTypeId = Schema.SObjectType.Task.getRecordTypeInfosByName().get('Operations - Task').getRecordTypeId();
            
            insert(task);
        }
        
      system.assertEquals(Schema.SObjectType.Task.getRecordTypeInfosByName().get('Operations - Task').getRecordTypeId(),task.recordtypeid);
             Test.stopTest();

I am getting below error
Comparison arguments must be compatible types: Id, Schema.SObjectField
Hi 

I have this code in my test class
 User u = [select Id from User where id =: UserInfo.getUserId() limit 1];
            system.runAs(u){
            Test.startTest(); 
            ReminderController m = new ReminderController('30 Days Reminder');
            String sch = '0 15 0 * * ?';
            String jobID = system.schedule('Actions Job',sch,m);
            Test.stopTest();
                
             list<actions__c> sc=[select id from actions__c];
             system.assertEquals(1, sc.size());  
               
        }
         
    }
with this code... start ,execute method of batch class are not executing..
User u = [select Id from User where id =: UserInfo.getUserId() limit 1];
            system.runAs(u){
            Test.startTest(); 
            ReminderController m = new ReminderController('30 Days Reminder');
            String sch = '0 15 0 * * ?';
            String jobID = system.schedule('Actions Job',sch,m);
            Test.stopTest();
               
        }
         
    }
and with this code... the batch class is running properly... I am not sure whats wrong.

Help needed to resolve this
,Thanks
Hi

I have a scheduled class for which I am writing test class.
So this scheduled class is inserting few records ,and how would I check in my test class that record is inserted or not.

I tried with below code.. but the execute method of scheduled class is executing after all statements in test classs, due to which I am not able to do assert equals for the records created.


@isTest
    static void test_SA_MG(){
  
        User u = [select Id from User where id =: UserInfo.getUserId() limit 1];
        
            system.runAs(u){
            Test.startTest(); 
           ReminderController Notification= new ReminderController('30 Days Reminder');
           Datetime sysTime = System.now().addSeconds(10);      
            String chronExpression = '' + sysTime.second() + ' ' + sysTime.minute() + ' ' + sysTime.hour() + ' ' + sysTime.day() + ' ' + sysTime.month() + ' ? ' + sysTime.year();
             System.schedule('Reminder', chronExpression,Notification);

            list<xyz__c> sc=[select id from xyz__c];
system.assertequals(1,sc.size());
            Test.stopTest();
        }

when I set the debug log for the above code.. I see the records are inserted for xyz__c object in scheduled class.. but list sc has 0 records.

Please let me know what can be done to solve this.
Thanks in advance
Hi

I was trying to fix all the issues with XSS in my vf page ,and found this line inside <script> tag
 window.location.href ='{!$Currentpage.parameters.retURL}
SO, my question is does it needs to be encoded like  window.location.href ='{!JSENCODE($Currentpage.parameters.retURL)} ?????
 Please provide me the explanation for better understanding..

Thanks
Hi

I am trying to get the result in testclass from SOSL query ,but the SOSL is not returning any values even when there is a matching test data.

Please refer below code:
User user=new User(FirstName='Test',
                             LastName='Contact',
                             Alias='tcont',
                             email='test.contact@xyz.com',
                             Username='test.contact@xyz.com',
                             CommunityNickname='cont',
                                        profileId=sysAd.id,
                             EmailEncodingKey=DummyUser.EmailEncodingKey,
                             TimeZoneSidKey=DummyUser.TimeZoneSidKey,
                             LocaleSidKey=DummyUser.LocaleSidKey,
                             LanguageLocaleKey=DummyUser.LanguageLocaleKey
                            );
                            insert user;
         System.RunAs(user){
        
         Account acc=new Account(Name='Test',
                                 RecordTypeId=accRecMap.get('Con').getRecordTypeId()
                                );
         insert acc;
         Contact cont=new Contact(Account=acc,
                                  FirstName='Test',
                                  LastName='Contact',
                                  AccountId = acc.Id,
                                  RecordTypeId=contRecMap.get(' Contact').getRecordTypeId()
                                 );
         insert cont;
         
        String userName=Userinfo.getName();
        Map<String, Schema.RecordTypeInfo> contactRecMap= Schema.SObjectType.Contact.getRecordTypeInfosByName();
      
                   
        String searchQueryCon = 'FIND \'' + userName + '\' IN ALL Fields RETURNING Contact(Id, Name,FirstName, LastName, Title, Email, Phone, Description)';
        System.debug(searchQueryCon);
        System.debug(cont);
        List<List<Contact>> contactListNew = search.query(searchQueryCon);
        System.debug(contactListNew);
       
         }
Hi All
Is there anyway to get notified about the user license expiration(salesforce,salesforce platform..) through email?

There is object 'UserLicense', but it doesnot have any details on expiration date to use it in workflow or process builder.

Would someone please suggest a way to get notified.
Thanks in advance
Hi

I have a string which is in format ('abc','xyz','efg').
Can someone please suggest how this string can be converted into list<string> with the value abc,xyz,efg.
Any help would be appreciated.

Thanks
Chaithaly
Hi
I have used slds-align_absolute-center slds-text-body_regular to align the texts to centre.
below is the snippet 
<lightning:card >

        <div class="slds-align_absolute-center slds-text-body_regular">

                <ul>

                    <!-- Body set dynamically-->
                </ul>
  
        </div>

    </lightning:card>

Alignment works properly when when texts are short , but when texts are long it is automatically aligning the texts to the left.

Can someone help with this.

Thanks
 
I have a requirement to launch a flow from lightning component using pageReference.
I was able to do it with WebPage pagereference type but domain name cant be consistant across the sandboxes.
So, trying to find out if we can navigate from a lightning page to a flow using lightning:navigation in any other way.

Thanks
Hi

I have a requirement to launch a flow from lightning component using pagreference.
I was able to do it with WebPage pagereference type but domain name cant be consistant across the sandboxes.
So, trying to find out if we can navigate from a lightning page to a flow using lightning:navigation  
Hi All

I am facing this error 'Apex event trigger cannot handle batch operations on recurring event' when trying to update 102 event records through data loader.

Could someone please tell what recurring events mean and why dataloader is throwing error on update .

Thanks in advance.
Chaithaly.
Hi

I have a trigger on event for after update , and inside the trigger i have given the condition if(trigger.isupdate){//statements}.

The scenario is, I am creating an event record , the after update trigger is executing the statements inside isupdate block in the same transaction.

Kindly help if i am missiong something.

Thanks
 
Hi ,

I am facing some issue related to Debug logs , I have set the Apex code to 'Finest' and tried generating the log , but all I see in logs is ' SYSTEM_METHOD_EXIT|' , SYSTEM_METHOD_ENTRY| , I dontt see any variable names/method names.User-added image

Can someone please let me know what could be the issue.
Hi 

I have this code in my test class
 User u = [select Id from User where id =: UserInfo.getUserId() limit 1];
            system.runAs(u){
            Test.startTest(); 
            ReminderController m = new ReminderController('30 Days Reminder');
            String sch = '0 15 0 * * ?';
            String jobID = system.schedule('Actions Job',sch,m);
            Test.stopTest();
                
             list<actions__c> sc=[select id from actions__c];
             system.assertEquals(1, sc.size());  
               
        }
         
    }
with this code... start ,execute method of batch class are not executing..
User u = [select Id from User where id =: UserInfo.getUserId() limit 1];
            system.runAs(u){
            Test.startTest(); 
            ReminderController m = new ReminderController('30 Days Reminder');
            String sch = '0 15 0 * * ?';
            String jobID = system.schedule('Actions Job',sch,m);
            Test.stopTest();
               
        }
         
    }
and with this code... the batch class is running properly... I am not sure whats wrong.

Help needed to resolve this
,Thanks
Hi All
Is there anyway to get notified about the user license expiration(salesforce,salesforce platform..) through email?

There is object 'UserLicense', but it doesnot have any details on expiration date to use it in workflow or process builder.

Would someone please suggest a way to get notified.
Thanks in advance
Hi

I have a requirement to launch a flow from lightning component using pagreference.
I was able to do it with WebPage pagereference type but domain name cant be consistant across the sandboxes.
So, trying to find out if we can navigate from a lightning page to a flow using lightning:navigation  
Hi All

I am facing this error 'Apex event trigger cannot handle batch operations on recurring event' when trying to update 102 event records through data loader.

Could someone please tell what recurring events mean and why dataloader is throwing error on update .

Thanks in advance.
Chaithaly.
Hi

I have a trigger on event for after update , and inside the trigger i have given the condition if(trigger.isupdate){//statements}.

The scenario is, I am creating an event record , the after update trigger is executing the statements inside isupdate block in the same transaction.

Kindly help if i am missiong something.

Thanks
 
Hi 
I have a visualforce page , where i need to display a text based on the picklist value .
<apex:outputPanel style="color:white"
       rendered="{!IF(Contact.Field1__c='value -WS 25 - A+',true,false)}" >
all other values are working fine except this value .
Please enlighten me if I am wrong.

Thanks
 
Hello,

I have this scenario where I have a child object called 'reserve__c'  for an 'opportunity' as a parent.

when a new opportunity is created ,I want to make sure user creates reserve__c record as well.
Can someone please help me with the solution! 

This is the trigger written to add the users to the opportunity team member related list


trigger oppTeammember2 on Opportunity (before insert) {
    
 
    list<opportunityteamMember> opp=new list<opportunityteamMember>();
user u=[select id from user where alias='cgowd' limit 1];
    for(opportunity o:trigger.new)
    {
        if(o.Amount>5000000)
        {
         opportunityteamMember o1=new opportunityteamMember();
           
             o1.TeamMemberRole='Account Manager';
            o1.userId=u.id;
            o1.OpportunityAccessLevel = 'All';
            o1.OpportunityId=o.id;
           
            opp.add(o1);
            
        }
         
        }
   insert opp;
            
    }

I am getting the error as:
oppTeammember2: execution of BeforeInsert caused by: System.DmlException: Insert failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Required fields are missing: [OpportunityId]: [OpportunityId] Trigger.oppTeammember2: line 21, column 1
 Any help is appreciable 
Thank you