• Salesforce Techie
  • NEWBIE
  • 55 Points
  • Member since 2022

  • Chatter
    Feed
  • 2
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 31
    Replies
If opportunity feedback status = Received then mail should go to team members and opportunity owner
With two different Email Templates
1 template will go to the opportunity owner and 2nd template will go to the opportunity owner and team members
Hi guys,

on Opportunityt object, I have a DATETIME field called "Appointment". How can I write a validation rule that only allow users to fill this field when Opportunity is at Qualification stage, if users try to fill this at another stage, like Identificaiton, validation rule will stop them, cheers

David
Scenario:
 User 1 :full access profile
User 2 : Limited access Profile with limited access license.

Step 1:Once the User 1 , submits the Record for Approval to User 2,
Step 2: User2 gets the Record to approve or Reject or Reassign
Step 3: User2 clicks on the Approve button and add an comment as approved.
Step 4: It was throwing an errror that "user dont have permissions to Perform Dml Operation on that Particular Custom object.

Need to Bypass that error,what will be the solution for it.  any custom functionality.

Please provide the Solution if you have faced the same scenario

Thanks
Sfdx
Goal: Create an Apex (content below) that fires every Monday at 7:00 am

↓Apex class

1. With SOQL, get the record of "Result__c object" that satisfies all of the following conditions①to③
①AcceptanceExpectedDate__c is from April 1st to September 1st in the first half and from October 1st to March 31st in the second half
②FulfillingAggregateFlg__c is false
③OrderProbabilityRank__c is 'A' or 'B' or 'C' or cOrderNo__c != null

2. Create a new record (I want to combine multiple records into one record)
・The value of the SE3__c item is 'Cloud Solution Department' , 'Industrial solution' , 'COLOPL'
Assign the sum of the LimitProfit__c items to the LimitIncomeSum__c item
→→I want to create a new record only with a value in the LimitIncomeSum__c field

・Set FillRage__c to the new record
・Set the Apex execution date to the new record in AggregateDate

I tried to write it, but I don't understand it at all.

-----------------------------------
global with sharing class FulfillingAggregate implements Database.Batchable<sObject> ,Schedulable, Database.Stateful {
    
    //Batchschedule
    global void execute(SchedulableContext sc) {
        FulfillingAggregate b = new FulfillingAggregate();
        database.executebatch(b,200);
    }

    
    //data acquisition
    global Database.QueryLocator start(Database.BatchableContext bc) {
        Date myToday = Date.Today();
        Date firstDate;
        Date endDate ;
        
        if (myToday.month() >= 4 && myToday.month() <= 9){
               
               firstDate = Date.newInstance(myToday.year(), 4, 1);
               endDate = Date.newInstance(myToday.year(), 9, 30);

        } else {
               
               firstDate = Date.newInstance(myToday.year(), 10, 1);
               endDate = Date.newInstance(myToday.year() + 1, 3, 31);
               
        }        
        //return Database.getQueryLocator('');  
        return Database.getQueryLocator('SELECT Id, SellingPrice__c, ExternalSales__c, InCompanySales__c, InCompanyTransfer__c, IndividualTransfer__c, AbilitySales__c, ProductCost__c, ExternalProductionCost__c, InternallyProductionCost__c, SalesTotalProfit__c, AcceptanceExpectedDate__c, FillRage__c, FulfillingAggregateFlg__c, SE1__c, SE2__c, SE3__c, SE4__c, FulfillingAggregateDate__c FROM Result__c WHERE FulfillingAggregateFlg__c = false AND (cOrderNo__c != null  OR OrderProbabilityRank__c = \'A\' OR OrderProbabilityRank__c = \'B\' OR OrderProbabilityRank__c = \'C\')' );   
        
        //return Database.getQueryLocator('SELECT Id, SellingPrice__c, ExternalSales__c, InCompanySales__c, InCompanyTransfer__c, IndividualTransfer__c, AbilitySales__c, ProductCost__c, ExternalProductionCost__c, InternallyProductionCost__c, SalesTotalProfit__c, AcceptanceExpectedDate__c, FillRage__c, FulfillingAggregateFlg__c, SE1__c, SE2__c, SE3__c, SE4__c, FulfillingAggregateDate__c FROM Result__c WHERE AcceptanceExpectedDate__c >= firstDate AND AcceptanceExpectedDate__c <= endDate AND FulfillingAggregateFlg__c = false AND (cOrderNo__c != null  OR OrderProbabilityRank__c = \'A\' OR OrderProbabilityRank__c = \'B\' OR OrderProbabilityRank__c = \'C\')' );   
    }
    
    global void execute(Database.BatchableContext bc, List<Result__c> resultList) {  
        Date myDate = Date.Today();
        List<Result__c> results = new List<Result__c>();
        for(Result__c result: resultList){
            if(result.IsClosed__c == FALSE){
                result.FulfillingAggregateFlg__c = true; /
                result.FulfillingAggregateDate__c = myDate; 
                
                results.add(result);
            }
        }    
        if(results.size()>0){
            insert results;
            }
    }
        

    global void finish(Database.BatchableContext bc){
        System.debug('FulfillingAggregateBatchProcessCompleted');  
    }
}
 
  • September 15, 2022
  • Like
  • 0

Hey guys

I've created a custom button to create a case from an opportunity in lightning version (I already had onde on classic)
The problem is when I set up the default field values:

/lightning/o/Case/new?
RecordTypeId=012D00000006XjXIAU&defaultFieldValues=AccountId={!IF(ISBLANK(Opportunity.Billing_Account__c),Opportunity.Account, Opportunity.Billing_Account__c)},Type=Provisioning,Business_unit__c=SaphetyDoc,Priority=S3 - Alta,Status=Open,Origin=Internal,Subject={!Opportunity.Name}+MCH OnBoarding_+{!Account.Country_Code__c}+{!Account.NIF__c},SuppliedEmail={!Opportunity.Email__c},Opportunity__c={!Opportunity.Id},Related_Project_Account__c={!IF(ISBLANK(Opportunity.Billing_Account__c),Opportunity.Account,Opportunity.Billing_Account__c)}

and the field business unit is not filled at all. I already check the record types on cases, and the option is there. More weird is the fact that the button on classic version works perfectly. I've attached a picture to see what is the output

Thank you!User-added image


public class VConnect_EInvoiceAuraHelper {
    @AuraEnabled
    public static void getInvoice(Id recordId) {
        // do some preprocessing.
        // execute the batch here
        Set<Id> poids = new Set<Id>();
        poids.add(recordId);
        System.debug('Called');
        Id jobId = Database.executeBatch(new BatchClassEInvoice(poids),200); // optional batch size can be provides as well.
    }
}
  • September 06, 2022
  • Like
  • 0
Hi 

I would like to know if we can deploy the dashboard from one production org to another production org. 
Hello there so below I did get the ageing days but i want to get hours too can someone help please
TEXT(

CASE(MOD( DATEVALUE(LastModifiedDate) - DATE(1985,6,24),7),
0 , CASE( MOD( DATEVALUE(NOW ()) - DATEVALUE(LastModifiedDate) ,7),1,2,2,3,3,4,4,5,5,5,6,5,1),
1 , CASE( MOD( DATEVALUE(NOW ()) - DATEVALUE(LastModifiedDate) ,7),1,2,2,3,3,4,4,4,5,4,6,5,1),
2 , CASE( MOD( DATEVALUE(NOW ()) - DATEVALUE(LastModifiedDate) ,7),1,2,2,3,3,3,4,3,5,4,6,5,1),
3 , CASE( MOD( DATEVALUE(NOW ()) - DATEVALUE(LastModifiedDate) ,7),1,2,2,2,3,2,4,3,5,4,6,5,1),
4 , CASE( MOD( DATEVALUE(NOW ()) - DATEVALUE(LastModifiedDate) ,7),1,1,2,1,3,2,4,3,5,4,6,5,1),
5 , CASE( MOD( DATEVALUE(NOW ()) - DATEVALUE(LastModifiedDate) ,7),1,0,2,1,3,2,4,3,5,4,6,5,0),
6 , CASE( MOD( DATEVALUE(NOW ()) - DATEVALUE(LastModifiedDate) ,7),1,1,2,2,3,3,4,4,5,5,6,5,0),
999)
+
(FLOOR(( DATEVALUE(NOW ()) - DATEVALUE(LastModifiedDate) )/7)*5)
)& " Day"

hi all..,
how to get the camelCase string with in the parenthesis brackets in the LWC JS..
for eg: Testing User (from all over the world)
now we want to display that string as..
Testing User (From All Over The World)
Thanks in advance.

  • August 28, 2022
  • Like
  • 0
Hi Everyone,
1. I presently have a dashboard which consisits of many reports which are built using standard report types of Account, Opportunity, Campaign with Contacts and Campaign with campaign members.
2. Initially i added all my source reports as components on the dashboard , added three dashboard filters; two account owner filters and one owner role filter.
3. Upon selecting any value from the owner role filter the Campaign with Contacts and Campaign with campaign members component errors with the error message : "The component can't be displayed because the field(s) you chose for the filter are unavailable"
4. I have checked that my source reports have the Owner role field added in them and are also grouped by owner role. 
5. When I tried to remove all dashboard filters and re-add them, surprisingly the owner role field didnt show up as an option anymore to add as a filter.
6. On removing the Campaign with Contacts and Campaign with campaign members component the field came up as an option again to add as a dashboard filter.
7. I tried building a seperate dashboard for two of the reports and added the same owner role filter and was able to filter the reports here.
> I wanted to understand what is causing the issue on the original dashboard leading to the error message : "The component can't be displayed because the field(s) you chose for the filter are unavailable" when the fields do exist and are even grouped on the source report.
Hi All,
I have created a custom field which is updating the attachment file id,using that i want to create a image formula which is working in static way,but working in dynamic way.
1st formula is working but it is static i have passed the id.2nd formula id not working which i want 
IMAGE("/sfc/servlet.shepherd/version/download/0680I000006s9wR", 'image alternate text',50,100)

IMAGE("/sfc/servlet.shepherd/version/download?file=+Imageurl__c", 'image alternate text',50,100)
Hi All,

I want to fetch items which loggedin user can approve and display in a pageblocktable.
Below is my code written so far -

   set<Id> setOfKnowledgeArticleId = new set<Id>();
   set<Id> setOfProcId= new set<Id>();
    
   //Below code gets pending items from ProcessInstance.
    listOfPending = [SELECT Id, TargetObjectId, Status, LastModifiedDate FROM ProcessInstance where Status='Pending' ORDER BY                                                 LastModifiedDate DESC ];
   for(ProcessInstance ProcessInstanceObj:listOfPending )
   {
        //Getting TargetObjectId to query Title,Summary from Custom Object and display in table
        setOfKnowledgeArticleId.add(ProcessInstanceObj.TargetObjectId);     
        // IDs to query the actor ID
        setOfProcId.add(ProcessInstanceObj.Id);        
   }
  
   
   listOfActors = [SELECT Id, ActorId FROM ProcessInstanceWorkitem  where Id IN: setOfProcId ];
   set<Id> setOfActId= new set<Id>();
   for(ProcessInstanceWorkitem pwObj:listOfActors  )
   {
        setOfActId.add(pwObj.Id);     
       
   }
   setOfActId is empty here, even though i know it should not be empty.

Please suggest how to achieve this. 
Please explain with example.
Hello all,
I am trying to build a customized "Items to Approve" list.  I have an "Approval__c" custom object that has an approval workflow.  I am trying to create a Visualforce page that is bound to the results of a query.  The query simple needs to return a list of Approvals for which the currently logged in user has a pending approval.  It is possible it isn't a query...but a query and some additional steps (loops, iteration, etc.)

Any help would be greatly appreciated!

Steve

All,
I'm writing a trigger to send an email notification to our Internal Owner (a custom field - Internal_Owner__c) of the Contact if a User chooses the Type 'Inbound Queue'. I'm unsure how to:
1.) Add in the SOQL 'Where Task.Type = 'Inbound Queue'.
2.) Send the notification to our Internal Owner of the Contact instead of whom the task is assigned to. Not sure if I need to create a formula field.

Here is my code thus far:

trigger LogACall_Send_Email on Task (before insert) {
    Set<Id> ownerIds = new Set<Id>();
    
    for(Task tsk: Trigger.New)
        ownerIds.add(tsk.ownerId);

    Map<Id, User> userMap = new Map<Id,User>([select Name, Email from User where Id in :ownerIds]);
    for(Task tsk : Trigger.New) {
        User theUser = userMap.get(tsk.ownerId);
        Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
        String[] toAddresses = new String[] {theUser.Email};
        mail.setToAddresses(toAddresses);
        mail.setSubject('Inbound Queue Call');
        String template = 'Hello {0}, \n\nAn Inbound Queue call was taken for you. Here are the details. \n\n';
        template+= 'Subject - {1}\n';
        template+= 'Due Date - {2}\n';
        template+= 'Type - {3}\n';
        template+= 'Comments - {4}\n';
        String duedate = '';
        if (tsk.ActivityDate==null)
            duedate = '';
        else
            duedate = tsk.ActivityDate.format();
        List<String> args = new List<String>();
        args.add(theUser.Name);
        args.add(tsk.Subject);
        args.add(duedate);
        args.add(tsk.type);
        args.add(tsk.Description);

        String formattedHtml = String.format(template, args);
       
        mail.setPlainTextBody(formattedHtml);
        Messaging.SendEmail(new Messaging.SingleEmailMessage[] {mail});
    }
}
I have a requirement of creating a many to many relationship between two objects Owner and contractor. My idea is to firstly create the juntion object and establish Master Detail Relationships on the junction object.

Later If I load the data(owner and contractor) through dataloader will the many to many realationship be in effect immediately or do i have to check for each and every record?
Hi,

Below given is my code and it is not the complete  .

I have Reservation object and invoice .When somebody registers with us ,Invoice for that customer should be automatically created as child object.

I have lookup relationship beyween invoice and Reservation.

I want to get all the invoices associate with the particular registration.Since reservation__ is the paretn object and invoice is the child,therefore,i am trying the following query in the code.However,I get the folowing error.

Compile Error: Didn't understand relationship 'reservation__r' in field path. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names. at line 166 column 49

Can somebody please help?


list<Reservation__c>pc=new List<Reservation__c>([select id,(select id from reservation__r.invoice__c)from reservation__c where reservation__c in:samp])



 


trigger  reservation on reservarion__c(before delete
{
Map<id,invoice__c>must=new Map<id,invoice__c>();
list<invoice__c>ok=new list<invoice__c>();
If(Trigger.IsBefore & Trigger.IsDelete)
{
//Map<id,invoice__c>must=new Map<id,invoice__c>();
//list<invoice__c>ok=new list<invoice__c>();
Set<id> samp=new set<id>();
For(reservation__c r:trigger.old)
{

samp.add(r.id);
System.debug('The values in the record of delete trigger of the samp is##########################'+samp);
}

list<Reservation__c>pc=new List<Reservation__c>([select id,(select id from reservation__r.invoice__c)from reservation__c where reservation__c in:samp])
}

Does anyone know what "/secur/logout.jsp" does?  I need to manually perform all of the logout tasks and then redirect to a different page.  Right now the logout.jsp redirects to login.salesforce.com.  I want to use a controller to do the logout tasks and then perform a redirect to something like http://mycustomloginpage.notsalesforce.com.

 

Thanks,

 

George

I'd like to create a custom link on the account page, which will link to a report. However, I want the report to only show values for that particular account. For instance, it would show all the activities for that account categorized by type of activity. I'm not sure how to use a link to dynamically customize a report like that. 

I can't figure out how to do this, and SF support sent me here... 

 

Thanks!
Ariel

  • March 27, 2010
  • Like
  • 0
How do I get a custom link to open up in the same window it was launched from?  Normally when I click on a custom link, it opens up the code it calls in a completely new salesforce window that is identical to the source window except for the new context in the iframe...