• Naresh Kaneriya 9
  • NEWBIE
  • 10 Points
  • Member since 2021
  • Salesforce Technical Lead at V2Force
  • V2Solutions


  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 12
    Replies
I have created one screen flow that will create a Contact record from the Account object and I placed that flow on the Quick Action button.

On that screen flow, I have two text field elements and their value will be auto-populated from Account.

I want to make those two fields on-screen as ready only so the user can edit them while creating a contact from the flow and once contact got created those field is editable for those users.

How we can make the field read-only on-screen flow?

Kindly note that I don't want to change FLS. 

Early response will be highly appreciated
Thanks in advance! 
0
List View Actions in Lightning Experience action is not available for standard Prdouct2 objects like its available for Case, lead, etc. objects.
Please refer to the below screenshot for case object
User-added image

please suggest if there is any setting which I missed? or any alternative way? Thanks in advance!!
Salesforce report displays a message as "This report has more results than we can show (up to 2,000 rows). Summary information is calculated from full report results." How to increase the number.

 
Hi 

I'm trying to create a report using the IF Function but am receiving the "Warning Incorrect parameter type for function 'IF()'. Expected Number, received Text" error message. 

The formula I'm trying to make work is: 
IF(Field 1 > 0.00, Field 2 - Field 1, "") 

All Fields in the formula are set as Currency fields. 

Thanks
Katy 
Hi,
  I have an object appointments which have a lookup field to Hospital(Hospital__c) and I have an object Hospital which contains the names of the hospital. I want to know how many appointments in each hospital. What is the query look like?

Thanks,
    Jo

Hi all,
Currently, we have a web-to-case for customer service. When and CS agent starts working on a case they must choose a value in the type picklist. Current values are pre-sales, post-sales and other to qualify the case. When the case is created the value on type is blank

How do I make a validation rule to check if the CS agent has done so before saving, and the validation rule does not prevent the case creation?

Hoping someone can give me a pointer on this.

Many tanks

trigger TaskAssignmentTrigger on Claims__c (before insert, before update) {
    List<Id> assignedUserIds = new List<Id>();

    for (Claims__c claim : Trigger.new) {
        if (claim.Assigns_to_be__c != null) {
            for (Assignment_Group_c__c membership : claim.Assigns_to_be__c) {
                assignedUserIds.add(membership.Users__c);
            }
        }
    }

    if (!assignedUserIds.isEmpty()) {
        TaskAssignmentHandler.addUsersToTask(assignedUserIds, Trigger.new[0].Id);
    }
}

 

Im getting an error "Loop must iterate over collection: Id". Dont know what is causing this error.Any help will be much apprecitated.

public class AttendanceEmailBatch implements Database.Batchable<SObject>, Database.AllowsCallouts {
    public Database.QueryLocator start(Database.BatchableContext context) {
        // Calculate start date for querying attendance records
        Date startDate = Date.today().addDays(3);
        Date endDate = startDate.addDays(3);

/*
 // Calculate start date for querying attendance records
    Datetime startDate = Datetime.now().addMinutes(1);
    Datetime endDate = startDate.addMinutes(1);
*/
        String query = 'SELECT Id, Name, Employee__c, Employee__r.Manager__r.Email__c, Statuss__c, Date__c ' +
                       'FROM Attendance__c ' +
                       'WHERE (Statuss__c = \'Present\' OR Statuss__c = \'Less than 9.15\' OR Statuss__c = \'Status Unknown\' OR Statuss__c = \'Shortfall\') ' +
                       'AND Date__c >= :startDate AND Date__c <= :endDate';

        return Database.getQueryLocator(query);
    }

    public void execute(Database.BatchableContext context, List<Attendance__c> scope) {
        List<Messaging.SingleEmailMessage> emailsToSend = new List<Messaging.SingleEmailMessage>();

        for (Attendance__c att : scope) {
            if (att.Employee__r != null && att.Employee__r.Manager__r != null && att.Employee__r.Manager__r.Email__c != null) {
                Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage();
                email.setToAddresses(new List<String>{att.Employee__r.Employee_Email__c});
                email.setCcAddresses(new List<String>{att.Employee__r.Manager__r.Email__c});
                email.setSubject('Attendance Status Notification');
                email.setPlainTextBody('Dear ' + att.Employee__r.Name + ',\n\n' +
                                       'Your attendance on ' + att.Date__c + ' has a status of "' + att.Statuss__c + '".\n\n' +
                                       'Please review your attendance record.\n\n' +
                                       'Sincerely,\nYour Company');
                emailsToSend.add(email);
            }
        }

        // Send the emails
        Messaging.SendEmailResult[] results = Messaging.sendEmail(emailsToSend);
        for (Messaging.SendEmailResult result : results) {
            if (result.isSuccess()) {
                System.debug('Email sent successfully.');
            } else {
                System.debug('Failed to send email. Error: ' + result.getErrors()[0].getMessage());
            }
        }
    }

    public void finish(Database.BatchableContext context) {
        // Perform any post-processing or cleanup if needed
    }
}

Used This one Batch class but it is not sending emails plz anone provide solution plz.

Full question Link:- https://developer.salesforce.com/forums/ForumsMain?id=9065d0000007BDKAA2
Hello,

I'm trying to set up a field that will track the minutes that a case's status is "in progress". I've read about and tried a lot of methods online but most were built using workflow rules or other features that are no longer supported or no longer work the same way. I'm trying to use flow builder to achieve this but I'm still learning and have begun to spin my wheels.

I just need a field to count the hours a case's status is set to "in progress" and to not count hours in any other status.That way we can track total time a case has been worked on. Our cases bounce between status' frequently. Often being closed or resolved and being opened again multiple times.

Thank you.
Hi,
I create date Field when the recorder is submitted and after i created 3 formula fields for 3,5,6,days using that Date field Like Below,But still i receiving the mails on sunday i need only Business days mon-fri
For Example i submit the record on friday i receive 3 day mail on wed,5day fri,6day mon(next week) like  
any one Help on this
3DAYS Reminder Business Days Only.
CASE(
WEEKDAY(Submitted_Date_For_Approval__c + 3),
1, (Submitted_Date_For_Approval__c + 3) + 1 + FLOOR(3/5)*2,
2, (Submitted_Date_For_Approval__c + 3) + 1 + FLOOR(4/5)*2,
3, (Submitted_Date_For_Approval__c + 3) + 1 + FLOOR(5/5)*2,
4, (Submitted_Date_For_Approval__c + 3) + 1 + FLOOR(6/5)*2,
5, (Submitted_Date_For_Approval__c + 3) + 1 + FLOOR(7/5)*2,
6, (Submitted_Date_For_Approval__c + 3) + 1 + CEILING(4/5)*2,
7, (Submitted_Date_For_Approval__c + 3) - IF(1>0,1,0) + 1 + CEILING(4/5)*2,
null
)


5DAYS Reminder Business Days Only.
CASE(
WEEKDAY(Submitted_Date_For_Approval__c + 5),
1, (Submitted_Date_For_Approval__c + 5) + 1 + FLOOR(3/5)*2,
2, (Submitted_Date_For_Approval__c + 5) + 1 + FLOOR(4/5)*2,
3, (Submitted_Date_For_Approval__c + 5) + 1 + FLOOR(5/5)*2,
4, (Submitted_Date_For_Approval__c + 5) + 1 + FLOOR(6/5)*2,
5, (Submitted_Date_For_Approval__c + 5) + 1 + FLOOR(7/5)*2,
6, (Submitted_Date_For_Approval__c + 5) + 1 + CEILING(4/5)*2,
7, (Submitted_Date_For_Approval__c + 5) - IF(1>0,1,0) + 1 + CEILING(4/5)*2,
null
)


6DAYS Reminder Business Days Only.
CASE(
WEEKDAY(Submitted_Date_For_Approval__c + 6),
1, (Submitted_Date_For_Approval__c + 6) + 1 + FLOOR(3/5)*2,
2, (Submitted_Date_For_Approval__c + 6) + 1 + FLOOR(4/5)*2,
3, (Submitted_Date_For_Approval__c + 6) + 1 + FLOOR(5/5)*2,
4, (Submitted_Date_For_Approval__c + 6) + 1 + FLOOR(6/5)*2,
5, (Submitted_Date_For_Approval__c + 6) + 1 + FLOOR(7/5)*2,
6, (Submitted_Date_For_Approval__c + 6) + 1 + CEILING(4/5)*2,
7, (Submitted_Date_For_Approval__c + 6) - IF(1>0,1,0) + 1 + CEILING(4/5)*2,
null
)
Description: When closing a case an email should trigger. need test class for this.

public class SendCasePrintableViewAsPDF extends AbstractTriggerHandler {
    public override void afterUpdate() {
        
        Set<Id> closedCaseIds = new Set<Id>();
        Map<Id, Case> oldCaseMap = (Map<Id, Case>)Trigger.oldMap;
        
        // Retrieve the custom label value containing the desired Record Type Developer Names.
    String customLabelValue = Label.CaseArchive_RecordType;
    List<String> desiredRecordTypes = customLabelValue.split(';');
        
        for (Case updatedCase : (List<Case>)Trigger.New) {
            system.debug('updatedCase.RecordType.DeveloperName===='+updatedCase.RecordTypeId);
            system.debug(updatedCase.RecordTypeid);
            Case oldCase = oldCaseMap.get(updatedCase.Id);
            if(updatedCase.IsClosed && !oldCase.IsClosed && desiredRecordTypes.contains(updatedCase.RecordTypeId)){
                system.debug('insideRT=======');
                closedCaseIds.add(updatedCase.Id);
            }
        }
        sendPDF(closedCaseIds);
    }

    @future(callout=true)
    private static void sendPDF(Set<Id> closedCaseIds) {
        // Define the email address where the PDF will be sent
        String recipientEmail = Label.CaseArchive_Email;
        
        // Query the necessary Case data and related records outside the loop
        List<Case> closedCases = [SELECT Id, Subject, Casenumber, origin, owner.name, ownerid, Description,Account.Name, Contact.Name
                                  FROM Case WHERE Id IN :closedCaseIds];

        // Generate the PDF for each closed case and send the email
        for (Case closedCase : closedCases) {
            // Generate the PDF content
            PageReference printablePage = Page.SendCasePrintableViewAsPDF; // Visualforce Page
            printablePage.getParameters().put('id', closedCase.Id);
            Blob pdfBlob;
            try {
                pdfBlob = printablePage.getContentAsPDF();
            } catch (VisualforceException e) {
                // Error handling for Vf page
                System.debug('Error generating PDF: ' + e.getMessage());
                continue;
            }

            // Create and send the email
            List<Messaging.SingleEmailMessage> emailMessagesList = new List<Messaging.SingleEmailMessage>(); 
            Messaging.SingleEmailMessage emailMessage = new Messaging.SingleEmailMessage();
            emailMessage.setToAddresses(new String[] { recipientEmail });
            emailMessage.setSubject(closedCase.CaseNumber + '-' + closedCase.Subject);
            String plainTextBody = '';
            plainTextBody += 'Case Number : '+ closedCase.CaseNumber +'\n';              
            plainTextBody += 'Case Origin : '+ closedCase.origin +'\n';
            plainTextBody += 'Case Owner : '+ closedCase.Owner.Name +'\n';
            plainTextBody += 'Subject : '+ closedCase.Subject +'\n';
            plainTextBody += 'Description : '+ closedCase.Description +'\n';
            plainTextBody += 'Contact Name : '+ closedCase.Contact.Name +'\n';
            plainTextBody += 'Account Name : '+ closedCase.Account.Name +'\n';
            emailMessage.setPlainTextBody(plainTextBody);
            emailMessage.setFileAttachments(new Messaging.EmailFileAttachment[] {
                new Messaging.EmailFileAttachment()
            });
            emailMessage.getFileAttachments()[0].setFileName('Case Number: ' + closedCase.CaseNumber + '.pdf');
            emailMessage.getFileAttachments()[0].setBody(pdfBlob);

            // Send the email
            emailMessagesList.add(emailMessage);
            Messaging.sendEmail(emailMessagesList, False);
            //Messaging.sendEmail(new Messaging.SingleEmailMessage[] { emailMessage });
        }
    }
}
I have a situation when Case Status field can be updated multiple times but what I need is once I made the status as closed, Date/Time closed field (under case object) should capture the 1st date time stamp when the case was closed and it should NOT be updated again irrespective of how many time status is getting changed.
Please help. Thanks in advance :)
0
List View Actions in Lightning Experience action is not available for standard Prdouct2 objects like its available for Case, lead, etc. objects.
Please refer to the below screenshot for case object
User-added image

please suggest if there is any setting which I missed? or any alternative way? Thanks in advance!!
I need some help finding a "best practices" kind of formula to handle this. We are changing to using a custom fiscal year (based on 4.4.5) The idea is that 3 days after the close of the fiscal month, you can no longer close a sale in that prior month. On the 4th day after the month closes, we run reports, and we can't have anyone going back and making entries in a month that's already been reported to the public. (Much like the way Accounting has to close each month. with no retroactive entries)
 
Example:  Fiscal June (2008) ended June 21st.  The reps have until June 24th to update any opportunities as having closed in June. I need a validation rule that, on June 25th, if someone tried to close a sale in fiscal June (or earlier), it will error out and say, "You've tried to close an opportunity during a month that is already closed. Please close this sale during the current month."
 
Before we moved to a custom fiscal year, I had a single formula that worked forever, using the MONTH() and DAY() functions. (Saying if it was greater than the 4th day of the month, the close date can't be less than the first day of the current month.) But those won't work for fiscal months.
 
Even trying to write a formula with the exact date ranges is giving me trouble. I can't get a single formula that can handle all 12 months in the year. I can't even get one that will handle two months, for that matter. I keep getting syntax errors. Too many OR and AND statements nested. (I can't say if it's a salesforce limitation or just my own problems with writing the formula!)
 
I could write 12 different validation rules for each year - one for each month. In that case, I'd write something like:
 
AND(
          OR(
                  ISNEW(),
                  ISCHANGED( StageName ),
                  ISCHANGED( CloseDate)
                  ),
           IsClosed = true,
           TODAY()>DATE(2008,6,24),
           CloseDate <DATE(2008,6,22)
         )
 
for each month (this one being June).
 
But I'd prefer to have it in one formula. Even something like this would have to be re-written every year, but I'd rather re-write one formula a year isntead of 12! So I'd rather have one formula that could handle it forever - like the one I could use when it was a Calendar Month.  But that may be asking for too much.
 
Any suggestions?
 
Thanks!!


Message Edited by Datajunkie on 06-27-2008 10:37 AM