• Abhishek Raj 23
  • NEWBIE
  • 60 Points
  • Member since 2017

  • Chatter
    Feed
  • 2
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 11
    Replies
Hi All,

I created a user with the Standard User Profile. Now, when I log in as that user and try to clone the profile, it is saying Insufficient Permissions.

Only a System Administrator can create and Clone Profile? Can a Standard User profile clone a profile?

Thanks,
Sirisha
 
Hello,
In the exercise "Create a unit test for a simple Apex trigger" , here is the code I wrote and for some reason it keeps giving me an Assertion failed 
@ line 24. Can you please help determine the reason?

@isTest
private class TestRestrictContactByName
 {
    @isTest static void TestMethodRestrictContact() {
        // Test data setup
        // Create an Account and its contact with Last Name = INVALIDNAME
        Account acct = new Account(Name='Test Account');
        insert acct;

List <Contact> contactlist = new List <Contact>();

Contact cont1 = new Contact(FirstName='Test1',LastName='INVALIDNAME',Email='test1@invalid.com',AccountId=acct.Id);
contactlist.add(cont1);
Contact cont2 = new  Contact(FirstName='Test2',LastName='VALIDNAME',Email='test2@valid.com',AccountId=acct.Id);
contactlist.add(cont2);

Test.startTest();
    try {
        insert contactlist;
        }
    Catch (DMLException exp) {
        for(integer i = 0; i < 2; i++) {
    //System.assert(exp.getMessage().contains('The Last Name "'+Contactlist[i].LastName+'" is not allowed for DML'));
    System.assert(exp.getMessage().contains('The Last Name INVALIDNAME is not allowed for DML'));
        }
    }
Test.stopTest();
}
}

 
Hi,

I was trying to schedule data loader using cmd in windows. Below is the .bat file I am using for scheduling.

@echo "off"
cls 
cd "C:\Program Files (x86)\salesforce.com\Data Loader\bin"
CALL process01.bat "C:\Users\Abhishek Raj\Desktop\DataLoader" "currencyInsert" 
Pause

where path after cd is the location of data loader, 
process01.bat is the batch file and after that is the path of the batch file. 
currencyInsert Process Name in Process-conf.xml

Please help me figure out if anything is wrong or missing in this batch file because data loader is not getting scheduled.

Thankyou
Hi,  
I am using images in the Visualforce email template which is stored in the documents in SFDC. These images does not load when viewing the email offline.Ideally the images should load in the email when we view it in our inbox irrespective of the internet connection, just like other data which we get usign merge fields.
Hi,

I was trying to schedule data loader using cmd in windows. Below is the .bat file I am using for scheduling.

@echo "off"
cls 
cd "C:\Program Files (x86)\salesforce.com\Data Loader\bin"
CALL process01.bat "C:\Users\Abhishek Raj\Desktop\DataLoader" "currencyInsert" 
Pause

where path after cd is the location of data loader, 
process01.bat is the batch file and after that is the path of the batch file. 
currencyInsert Process Name in Process-conf.xml

Please help me figure out if anything is wrong or missing in this batch file because data loader is not getting scheduled.

Thankyou

Hi all,

I am integrating Outlook with Salesforce where in I am facing an issue when I am composing an email with attachment in it, I select the tab of Log Email on send but it doesn't display the attachment of the mail in salesforce.

 I am attaching an image which decpicts the exact sitauion I am facing.

Kindly reply if anyone has worked on the same.

Thank you in advance!
User-added image  

I need help with creating a field that auto-populates the “Standard Price” from the Product object into a field called “Base Price” in the Transactions custom object.
 
Use Case:
 
When a Transaction record is created, the Item Number should be looked up in the Product object "Product Code", then the "Standard Price" should be returned in the "Base Price" field
 
Example:
 
The transaction is created with item number 2200, we should look up the Product object and find the Product with Product code 2200.  Then we should return the standard price of $80.00 into the “Base Price” field.
I want to get records of contact based on Birthdate.
eg: i need to display contact records in ASC order of next 60 days. so how to use GROUP BY CALENDAR_MONTH(Birthdate) ASC .
If I use GROUP BY Birthdate ASC It will return date in ascending order.

I am trying SOQL query like this
select id, name,PhotoUrl,Birthdate from Contact WHERE Birthdate != null AND Birthdate = NEXT_N_DAYS:60 ORDER BY CALENDAR_MONTH(Birthdate) ASC, DAY_IN_MONTH(Birthdate) ASC LIMIT 5 OFFSET 0

[object Object]: Ordered field cannot be aggregated in a query that is not grouped: CALENDAR_MONTH(Birthdate)

I need this solution through SOQL without using apex
Do you have any solution to sort birthdate based on month and date then please help me
Hi Everyone;
In each interview i am being asked this question but i am unable to write and run it properly.
Here is question:
write a trigger which will populate sum of child field values on prarent.(basically count Rollup summary trigger for lookup relationship)
I did search in community and got below program which is still not working:

trigger SumTrigger on Contact (before insert) {
list<Account>accts=new list<Account>();
set<ID>IDs=new set <ID>() ;
  if(trigger.isInsert||trigger.isUndelete){
      for(contact con:trigger.new) {  
      IDs.add(con.accountId) ;      
      }}   
    
  else if(trigger.isDelete){
      for(contact con:trigger.old) {  
      IDs.add(con.accountId) ;      
      }}   
 
else if(trigger.isUpdate){
      for(contact con:trigger.new) {
          if(con.AccountId !=null){
           IDs.add(con.accountId) ;   
          }     
            
      }}   
      
  if(IDs.size()>0){
 accts=[select id,TotalValue__c,(select id,value__c from contacts ) from Account where id in :IDs];              
  }     

  for(Account a:accts)  {
    for (contact c:a.contacts){
    a.TotalValue__c +=c.value__c;    
    }
        update accts; 
    }
}

No complie error but when inserting contact record getting below error:

SumTrigger: execution of BeforeInsert caused by: System.NullPointerException: Attempt to de-reference a null object Trigger.SumTrigger: line 30, column 1

also on modifying a section like below 

for(Account a:accts)  {
    decimal Value=0;
    for (contact c:a.contacts){
    value += c.value__c;
        
    }
    a.TotalValue__c =value;    
        
    }
     update accts;                 
}

again getting below error on insering any contact record:
SumTrigger: execution of BeforeInsert caused by: System.NullPointerException: Argument cannot be null. Trigger.SumTrigger: line 29, column 1

Please help me with easy trigger code to make it work.

Thanks in advance;
Hi All,

I created a user with the Standard User Profile. Now, when I log in as that user and try to clone the profile, it is saying Insufficient Permissions.

Only a System Administrator can create and Clone Profile? Can a Standard User profile clone a profile?

Thanks,
Sirisha
 
<td>
                                <ui:inputcheckbox updateOn="change" change="{!c.SaveChanges}" text="{!item.Id}" value="{!item.CSopke1__Complete__c}"/>
                            </td>
                            <td>
                                <ui:inputDate  updateOn="change" change="{!c.searchChange}" value="{!item.CSopke1__Date__c}" displayDatePicker="true" />
                            </td>
                            <td>
                                <ui:inputText updateOn="change" change="{!c.searchChange}" value="{!item.CSopke1__Notes__c}"/>
                            </td>
Helper.js
SaveChanegHelper: function (cmp, event, helper) {
        var action = cmp.get('c.updateProcess');
        var processId = event.getSource().get("v.text");
        var iscompleted = event.getSource().get('v.value');
        var FieldLabel = ???
how I can get to know which field was changed so that I need to pass this fieldApi to further Apex controller toupdate record accordingly.
 
I am having trouble with a valdiation formula that checks two sets of criteria.
Criteria 1 - Field A = Yes AND Field B's number field is greater than 0.
Criteria 2 - Field A = Yes AND Field B's number field is greater than 0 AND Field C = Yes AND Field D not equal to BLANK

The first and second criteria reference the same elements but should be independent of each other. My formula "seems" to workfor Criteria 2 but not 1.

AND( NOT(ISPICKVAL(Furniture_Delivered_Model_Setup__c, 'No')), Attachment_Added__c>0, OR( AND( NOT(ISPICKVAL(Virtual_Tour__c, 'No')), NOT(ISBLANK(Model_Promo_Virtual_Tour__c)), NOT(ISPICKVAL(Furniture_Delivered_Model_Setup__c, 'No')), Attachment_Added__c>0) ))

Any help is greatly appreciated
  • February 20, 2019
  • Like
  • 0
Hello,
In the exercise "Create a unit test for a simple Apex trigger" , here is the code I wrote and for some reason it keeps giving me an Assertion failed 
@ line 24. Can you please help determine the reason?

@isTest
private class TestRestrictContactByName
 {
    @isTest static void TestMethodRestrictContact() {
        // Test data setup
        // Create an Account and its contact with Last Name = INVALIDNAME
        Account acct = new Account(Name='Test Account');
        insert acct;

List <Contact> contactlist = new List <Contact>();

Contact cont1 = new Contact(FirstName='Test1',LastName='INVALIDNAME',Email='test1@invalid.com',AccountId=acct.Id);
contactlist.add(cont1);
Contact cont2 = new  Contact(FirstName='Test2',LastName='VALIDNAME',Email='test2@valid.com',AccountId=acct.Id);
contactlist.add(cont2);

Test.startTest();
    try {
        insert contactlist;
        }
    Catch (DMLException exp) {
        for(integer i = 0; i < 2; i++) {
    //System.assert(exp.getMessage().contains('The Last Name "'+Contactlist[i].LastName+'" is not allowed for DML'));
    System.assert(exp.getMessage().contains('The Last Name INVALIDNAME is not allowed for DML'));
        }
    }
Test.stopTest();
}
}

 
I have a trigger where if the Approval Process is Rejected and the Comments are blank the following page displays. My issue is that I would like to customize the error page so that the actual error is more prominent for the users. Is this possible?

Everything I see is related to error messages from VF pages.

trigger RequireRejectionComment on Contact (before update) 
{

  Map<Id, Contact> rejectedStatements 
             = new Map<Id, Contact>{};

  for(Contact inv: trigger.new)
  {
    /* 
      Get the old object record, and check if the approval status 
      field has been updated to rejected. If so, put it in a map 
      so we only have to use 1 SOQL query to do all checks.
    */
    Contact oldInv = System.Trigger.oldMap.get(inv.Id);

    if (oldInv.SAL_Approval_Status__c != 'Rejected' 
     && inv.SAL_Approval_Status__c == 'Rejected')
    { 
      rejectedStatements.put(inv.Id, inv);  
    }
  }
   
  if (!rejectedStatements.isEmpty())  
  {
    // UPDATE 2/1/2014: Get the most recent approval process instance for the object.
    // If there are some approvals to be reviewed for approval, then
    // get the most recent process instance for each object.
    List<Id> processInstanceIds = new List<Id>{};
    
    for (Contact invs : [SELECT (SELECT ID
                                              FROM ProcessInstances
                                              ORDER BY CreatedDate DESC
                                              LIMIT 1)
                                      FROM Contact
                                      WHERE ID IN :rejectedStatements.keySet()])
    {
        processInstanceIds.add(invs.ProcessInstances[0].Id);
    }
      
    // Now that we have the most recent process instances, we can check
    // the most recent process steps for comments.  
    for (ProcessInstance pi : [SELECT TargetObjectId,
                                   (SELECT Id, StepStatus, Comments 
                                    FROM Steps
                                    ORDER BY CreatedDate DESC
                                    LIMIT 1 )
                               FROM ProcessInstance
                               WHERE Id IN :processInstanceIds
                               ORDER BY CreatedDate DESC])   
    {                   
      if ((pi.Steps[0].Comments == null || 
           pi.Steps[0].Comments.trim().length() == 0))
      {
        rejectedStatements.get(pi.TargetObjectId).addError(
          'Please provide a rejection reason in the Comments field. Click the back arrow on your browser to go back to the Approve/Reject page.');

      }
    }  
  }
}

User-added image