• Manvitha
  • NEWBIE
  • 95 Points
  • Member since 2021

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 27
    Questions
  • 9
    Replies
Hi All,
 I have created the batch class to create the custom records(fieldusage count object ) for each field of the passing object but gettig error 
can someone help here 
public class FieldUsageBatch implements Database.Batchable<sObject> {
public String objectName;

public FieldUsageBatch(String objName) {
objectName = objName;
}

public Database.QueryLocator start(Database.BatchableContext bc) {
String queryString = 'SELECT ';
Map<String, Schema.SObjectField> fieldMap = Schema.getGlobalDescribe().get(objectName).getDescribe().fields.getMap();
List<String> customFieldNames = new List<String>();
for (String fieldName : fieldMap.keySet()) {
Schema.DescribeFieldResult fieldDescribe = fieldMap.get(fieldName).getDescribe();
if (fieldDescribe.isCustom()) {
customFieldNames.add(fieldName);
}
}
queryString += String.join(customFieldNames, ', ') + ' FROM ' + objectName;

return Database.getQueryLocator(queryString);
}

public void execute(Database.BatchableContext bc, List<sObject> scope) {
Map<String, Integer> fieldUsageMap = new Map<String, Integer>();
String objectFieldName = objectName + '.';

String aggregateQuery = 'SELECT ';
for (String fieldName : fieldUsageMap.keySet()) {
aggregateQuery += fieldName + ', COUNT(Id) countField' + fieldName + ' ';
}
aggregateQuery += 'FROM ' + objectName + ' GROUP BY ';
for (String fieldName : fieldUsageMap.keySet()) {
aggregateQuery += fieldName + ', ';
}
aggregateQuery += 'Id';

List<AggregateResult> results = Database.query(aggregateQuery);
for (AggregateResult result : results) {
for (String fieldName : fieldUsageMap.keySet()) {
Integer count = Integer.valueOf(result.get('countField' + fieldName));
String fieldValue = String.valueOf(result.get(fieldName));
if (fieldValue != null && count > 0) {
if (!fieldUsageMap.containsKey(fieldName)) {
fieldUsageMap.put(fieldName, count);
} else {
fieldUsageMap.put(fieldName, fieldUsageMap.get(fieldName) + count);
}
}
}
}

List<Field_Usage_Count__c> fieldUsageList = new List<Field_Usage_Count__c>();
for (String fieldName : fieldUsageMap.keySet()) {
Field_Usage_Count__c fieldUsage = new Field_Usage_Count__c(
External_Object_ID__c = objectName + '_' + fieldName, // Use an External Id field for upsert
Object_Name__c = objectName,
Field_Name__c = fieldName,
Count__c = fieldUsageMap.get(fieldName)
);
fieldUsageList.add(fieldUsage);
}

if (!fieldUsageList.isEmpty()) {
upsert fieldUsageList External_Object_ID__c; 
}
}

public void finish(Database.BatchableContext bc) {

}
}
Thank you in advance

Hi All,

PFA 

User-added imageI am unable to see the user details for the completed task in the Activity Section .

Actually these task were assigned to the group but as a non member of that group I am unable to see the user or group info who completed the task .
but if i login as member of that group I am able to to see the  group info who completed the task like "Group D had a Task" in the same activity section .

Can anyone help me with this is there any sharing that needs to checked for this . or is this normal behaviour

 

Thanks alot in advnc 

Hi all,

https://help.salesforce.com/s/articleView?id=000386971&type=1

As per the above blog , if Users create a Task and assign it to any other User, the Task's assignee should receive the Task assignment email notification , which works based on whether "Email me when someone assigns me a task" preference is selected in their Reminder & Alerts setup section.(activity section ) or not .

But i wanted to know if Users create a Task and assign it to a group which he doesnt belongs to, will the Task's assignees(means all gourp members ) receives the Task assignment email notification ???

Can anyone put some light on this :))

TIA 
 

Hi all .
Is there any app which can extract all the field which includes all its custom definitions from a org.

app which can find usage of field in saleforce data / org records and also in tecnical components .
like for eg  if there is custom field  '"Mobile no."  on account then i have to know in which and all technial componnets it is used also in how many records this fields holds a value in Salesforce.

 

TIA 

 

Hi All ,
I do have one requirement where the completed task should be visible to Opportunity owner user on the activity section but  few task we are automatically assigning it to group in which it is not showing " "Group had a task "  rather its showing like below image 

so is it because the user is not a member of that group .??

 

if i logging as member of thatgroup I am able to see  like "Group had a task"

Any Salesforce limitation are is it standard behaviour??Any document!?

Thanks in Advnc!
User-added image

Hi All ,

Need help on one scenario: If the opportunity is cloned all the related list /records will be cloned .But in my scenario even after cloning,  on the old opportunity a few new tasks should be automatically created .& I want these tasks to be shown on the cloned opportunity as well in the activity  .Can someone confirm is that possible and if yes how can we achive this .

NOTE;on  old oppo and new or cloned oppo , 3 task will automatially create simulateously 
Thanks in Advance 

 

Hi All ,

can somebody help me on this please !?
I need to test the below piece of code where i have written this in catch block of some pqr class method
But i am strucked how to test it in anonymous window:
catch (exception ex)
mainclass.mainwrapper wrapp = new mainclass.mainwrapper();
                wrapp.excp= ex;
                wrapp.orgId = UserInfo.getOrganizationId();
                wrapp.winName = UserInfo.getOrganizationName();
                wrapp.cName = 'xyz class';
                wrapp.mName = 'abc method';
                ExceptionLog__c newExceptionLog = new ExceptionLog__c();
                newExceptionLog = mainclass.mno-method(wrapp);
                insert newExceptionLog;


Thanks in Advance !

Hi All , Can someboy help me to resolve this issue?Method does not exist or incorrect signature: void getDuplicateResult() from the type Database.SaveResult ....I am using it in my test class 

 

Database.DMLOptions dmlOpts = new Database.DMLOptions();
dmlOpts.DuplicateRuleHeader.allowSave = true;
Database.SaveResult saveResult = Database.insert(duplicateAcc, dmlOpts);
System.assert(saveResult.isSuccess());
DuplicateRecordSet drs = [SELECT Id FROM DuplicateRecordSet WHERE Id =:saveResult.getDuplicateResult().getDuplicateRecordSetId()];
 

Hi All,
 
I am new to  apex programming...so needed some help...
to write a new batch class that will be scheduled daily nightly to pick up records from ‘DuplicateRecordSet’ and find related account  records, keep the latest created/modified account  record and delete others.


Any help or guidance on this will be great !!!
Thanks in advance
Hi All,
 
I am new to  apex programming...so needed some help...
I have created a custom object which has custom text field For paricular record type of custom object i need populate this field based on lookup relations i have with other object 

ex: On Account obj =custom field is  Outletid is field  and record type is personal account , the custom field should be populated from Organisation objects custom field ORGID

Any help or guidance on this will be great !!!
Thanks in advance

Hi All,

In the JSON payload the custom picklist field value = "Delhi " sent to CRMconnect Compound-API but in Salesforce custom object that custom picklist  field value is empty.
Seems like the value is not shown in the UI but accessable via SOQL.

can anyone pour some knowledge why is it happening as I am very new to this external system integration things

Thanks In Advance

Hi all , 
 I have one large method which i need to split it into two ,have one doubt 
public static void method1( List<Contact> conList, Set<ID> accountIdSet, Set<ID> OrgId){

performing some acction1
{
//
}
method2(conList,accountIdSet,OrgId);
}

public static void method2( List<Contact> conList, Set<ID> accountIdSet, Set<ID> OrgId){
performing some action2
{
//
}
}


since I am calling method2 in method 1 will the parameter are same or will it differs in method 1 and method 2 ?
means will same contactlist is passed in mtehod 2 as that on mthod 1 ..Please help 
​​​​​​​TIA
Hi all,
Need to resolve some Program for Management Development (PMD) issue , have classes containing public methods & attributes  and are called in so many triggers so cant make those private , so can anyone help me on this , how can i  achieve pmd problm free classes . 

err: 1. This class has a bunch of public methods and attributes 
2 .Too many fields 

Hi All , 

I am new to apex ,working on one apex class where it contains many pmd issue including NcssMethod count to  reduce it i am splitting methods , where i got into some trouble ...let me explain this.
 public static void method1 () {
for(case c : caselist ){

if(condition satisfy){

///my other lines of code which i am going to split & and make another method (lengthy code )
}}
}
so my question is in the sub method is it requeired to check for & if condtion and call that after this method1's if condition ?

am i doing wrng by checking two time for condtion?

please somebody help to get clarity on this 

Thanks in Advnc!! : )

Hi All,

has anybody have idea why the salesforce exam slots are not available for dates from Nov 17th till dec 7th in webessor ..as i planned to take up i was searching but its not allowing it for those span.
Hi All,
 
How would I create a formula that extracts the time from a LastModifiedDate field.  For example:
 
Last Modified By = David Levins, 1/31/2012 9:58 AM
Want user name concatinated Time Stamp custom formula field to equal "9:58 AM"
 I have created 1 custom object , in that i want fetch this detail in custom formula field where formula of this field should be like this 
User Name concatenated with lastmodifieddate( but i dont want to use this i tried like SUBSTITUTE(TEXT(  LastModifiedDate ), TEXT( DATEVALUE( LastModifiedDate)) , '') this gave me time in zulu timezone
Thank you in Advnc.
hello All,
My question is will the last modified date chnages on updation of parent record using process builder?
Let me explain briefly . My sceario is based on opportunity "bill account" I am populating the quote bill address using process builder ,but my question is whenever i edit opportunity along with opportunity's Last Modified date , quote's Last Modified date is also getting updated 
Is there any way to restrict this?
thanks in advance !
Hi All,
Can someone help me to hide standard NEW button in related list excluding Sytem Admin profile
Currently I am using dynamic related list single , but I am not getting filter option to apply for this NEW button.
Thanks in advanceUser-added image
 
Hi Experts,
Have one requirement regarding the New task , Requiremnet is like this:
when i click on new task ,in standard Name fields i should get only related contacts
for example : If I am in account record page , then in Name field i should get only related accounts contacts while creating New task.
 If I am in Opportunity record page , then in Name field i should get only related Opportunity contacts/ based on the other contact related fields on Oportunity.
Can anyone help me with this.?
Thanks in Advance!!!!here i created one custom lookup ContactName, it is now giving me contacts related to the account , but if I  go to opportunity and click on Name is not showing any related contacts to that Opprtunity

 
public class ApprovalProcessController{
     public static String generateApprovalURL(String recordID){
         String url='';
         List<ProcessInstanceWorkitem> workItemLst = [SELECT id FROM ProcessInstanceWorkitem WHERE processInstance.TargetObjectId=:recordID];
            if(workItemLst.size() > 0){
               url='https://'+ System.URL.getSalesforceBaseUrl().getHost() + '/p/process/ProcessInstanceWorkitemWizardStageManager?id=' + workItemLst[0].id;
            }
        return url;
     }
    
     public static String getQuoteNames(String recordID){
         String Name;
       // List<Quote__c> quote = [select Id,Name FROM Quote__c WHERE Id=:recordID];
         for(Quote__c quote:[select Id,Name FROM Quote__c WHERE Id=:recordID]){
             Name=quote.Name;
         }
        return Name;
    }
}
Hi All,
 I have created the batch class to create the custom records(fieldusage count object ) for each field of the passing object but gettig error 
can someone help here 
public class FieldUsageBatch implements Database.Batchable<sObject> {
public String objectName;

public FieldUsageBatch(String objName) {
objectName = objName;
}

public Database.QueryLocator start(Database.BatchableContext bc) {
String queryString = 'SELECT ';
Map<String, Schema.SObjectField> fieldMap = Schema.getGlobalDescribe().get(objectName).getDescribe().fields.getMap();
List<String> customFieldNames = new List<String>();
for (String fieldName : fieldMap.keySet()) {
Schema.DescribeFieldResult fieldDescribe = fieldMap.get(fieldName).getDescribe();
if (fieldDescribe.isCustom()) {
customFieldNames.add(fieldName);
}
}
queryString += String.join(customFieldNames, ', ') + ' FROM ' + objectName;

return Database.getQueryLocator(queryString);
}

public void execute(Database.BatchableContext bc, List<sObject> scope) {
Map<String, Integer> fieldUsageMap = new Map<String, Integer>();
String objectFieldName = objectName + '.';

String aggregateQuery = 'SELECT ';
for (String fieldName : fieldUsageMap.keySet()) {
aggregateQuery += fieldName + ', COUNT(Id) countField' + fieldName + ' ';
}
aggregateQuery += 'FROM ' + objectName + ' GROUP BY ';
for (String fieldName : fieldUsageMap.keySet()) {
aggregateQuery += fieldName + ', ';
}
aggregateQuery += 'Id';

List<AggregateResult> results = Database.query(aggregateQuery);
for (AggregateResult result : results) {
for (String fieldName : fieldUsageMap.keySet()) {
Integer count = Integer.valueOf(result.get('countField' + fieldName));
String fieldValue = String.valueOf(result.get(fieldName));
if (fieldValue != null && count > 0) {
if (!fieldUsageMap.containsKey(fieldName)) {
fieldUsageMap.put(fieldName, count);
} else {
fieldUsageMap.put(fieldName, fieldUsageMap.get(fieldName) + count);
}
}
}
}

List<Field_Usage_Count__c> fieldUsageList = new List<Field_Usage_Count__c>();
for (String fieldName : fieldUsageMap.keySet()) {
Field_Usage_Count__c fieldUsage = new Field_Usage_Count__c(
External_Object_ID__c = objectName + '_' + fieldName, // Use an External Id field for upsert
Object_Name__c = objectName,
Field_Name__c = fieldName,
Count__c = fieldUsageMap.get(fieldName)
);
fieldUsageList.add(fieldUsage);
}

if (!fieldUsageList.isEmpty()) {
upsert fieldUsageList External_Object_ID__c; 
}
}

public void finish(Database.BatchableContext bc) {

}
}
Thank you in advance

Hi All,

PFA 

User-added imageI am unable to see the user details for the completed task in the Activity Section .

Actually these task were assigned to the group but as a non member of that group I am unable to see the user or group info who completed the task .
but if i login as member of that group I am able to to see the  group info who completed the task like "Group D had a Task" in the same activity section .

Can anyone help me with this is there any sharing that needs to checked for this . or is this normal behaviour

 

Thanks alot in advnc 

Hi all .
Is there any app which can extract all the field which includes all its custom definitions from a org.

app which can find usage of field in saleforce data / org records and also in tecnical components .
like for eg  if there is custom field  '"Mobile no."  on account then i have to know in which and all technial componnets it is used also in how many records this fields holds a value in Salesforce.

 

TIA 

 

Hi All,
 
I am new to  apex programming...so needed some help...
I have created a custom object which has custom text field For paricular record type of custom object i need populate this field based on lookup relations i have with other object 

ex: On Account obj =custom field is  Outletid is field  and record type is personal account , the custom field should be populated from Organisation objects custom field ORGID

Any help or guidance on this will be great !!!
Thanks in advance

Hi All,

In the JSON payload the custom picklist field value = "Delhi " sent to CRMconnect Compound-API but in Salesforce custom object that custom picklist  field value is empty.
Seems like the value is not shown in the UI but accessable via SOQL.

can anyone pour some knowledge why is it happening as I am very new to this external system integration things

Thanks In Advance

Hi all,
Need to resolve some Program for Management Development (PMD) issue , have classes containing public methods & attributes  and are called in so many triggers so cant make those private , so can anyone help me on this , how can i  achieve pmd problm free classes . 

err: 1. This class has a bunch of public methods and attributes 
2 .Too many fields 
Hi All,
Can someone help me to hide standard NEW button in related list excluding Sytem Admin profile
Currently I am using dynamic related list single , but I am not getting filter option to apply for this NEW button.
Thanks in advanceUser-added image
 
We have customized report type that uses User as primary object and Identity even log as secondary ,based on this we have one report to tract lgin details along with login device details ie whether the user is using android or ios , 
My question is this field device details is only visible to system admins, how to enable the view permission to other profiles
I am really tired of having issues with and being sent flow application errors. Please help.


Error element myRule_1_A1 (FlowActionCall).
An error occurred when executing a flow interview.

Flow Details
Flow API Name: Add_Product_to_Ticket
Type: Record Change Process
Version: 7
Status: Active
Org: AAON, Inc. (00Dj0000001ri7u)

Flow Interview Details
Interview Label: Add_Product_to_Ticket-7_InterviewLabel
Current User: Beth Walter (005j000000CM2Ow)
Start time: 2/25/2021 10:36 AM
Duration: 0 seconds

How the Interview Started
Beth Walter (005j000000CM2Ow) started the flow interview.
API Version for Running the Flow: 49
Some of this flow's variables were set when the interview started.
myVariable_old = null
myVariable_current = Ticket__c (a003Z00000nREnfQAG)

ASSIGNMENT: myVariable_waitStartTimeAssignment
{!myVariable_waitStartTimeVariable} Equals {!$Flow.CurrentDateTime}
Result
{!myVariable_waitStartTimeVariable} = "2/25/2021 10:36 AM"

DECISION: myDecision
Outcome executed: myRule_1
Outcome conditions:
{!myVariable_current.Part_Number__c} (ASM01635) Does not equal OE332-23P-VCMX-MOD-A

DECISION: myRule_1_pmetdec
Outcome executed: myRule_1_pmetnullrule
Outcome conditions:
{!myVariable_old} (null) Is null true

ADD_PART_NUMBER_TO_TICKET_PRODUCT (FLOWS): myRule_1_A1
Inputs:
TicketID = {!myVariable_current.Id} (a003Z00000nREnfQAG)
PartNumber = {!myVariable_current.Part_Number__c} (ASM01635)

Error Occurred: An error occurred when executing a flow interview.