• Mustafa Jhabuawala
  • NEWBIE
  • 241 Points
  • Member since 2016
  • Independent Salesforce Consultant


  • Chatter
    Feed
  • 5
    Best Answers
  • 2
    Likes Received
  • 1
    Likes Given
  • 9
    Questions
  • 117
    Replies
Hi,

This was working perfectly fine from past so many months and suddenly 2 days back this started throwing an error while executing test classes.

Code to execute
List<Contact> listContact = ContactTestDataFactory.createContact(1, 'FirstName', 'LastName'); insert listContact;

ContactTestDataFactory Test Class -
//Create Contact object 
public static List<Contact> createContact(Integer no_of_contact,String FirstName, String LastName){ 

List<String> lstSalutation = new List<String>{'Mr.','Ms.','Mrs.','Miss.','Dr.','U.S. Senator','U.S. Representative','Governor','Governor’s Cabinet Secretaries','Attorney General','State Senator','State Representative','Judge','Mayor','Consul-General','Ambassador','Ambassador to the U.S.','President of a Country','Former President','Lady','Police Chief','Chief Marshal','Dean','Professor','Priest','Pastor','Monsignor','Cantor','Rabbi','Nun or Sister','Brother','Bishop','Cardinal','Swami'}; 

List<Contact> listContact= new List<Contact>(); Contact objCon = new Contact(); 

for(Integer i=0;i<no_of_contact ;i++){ 
objCon = new Contact(); 
objCon.FirstName= FirstName; 
objCon.LastName= LastName; 
objCon.Salutation= lstSalutation[i]; objCon.Giving_Status__c= 'Prospect'; objCon.npe01__Primary_Address_Type__c = 'Residence'; objCon.MailingStreet = 'test'+i; 
objCon.Street_2__c = 'test 2'+i; objCon.MailingState='test'+i; objCon.MailingCity='test'+i; objCon.MailingCountry='test'+i; 
objCon.Gender__c = 'Female'; 
objCon.FirstName= FirstName; if(i/2 == 0){ objCon.Gender__c= 'Male'; 
} 
else{ 
objCon.Gender__c= 'Female'; 
} 
objCon.Unique_ID__c = String.valueOf(i); listContact.add(objCon); 
} 
System.debug('listContact'+listContact); 
return listContact; 
}

ERROR thrown - 
System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, npsp.TDTM_Contact: execution of AfterInsert

caused by: System.DmlException: Insert failed. First exception on row 0; first error: DUPLICATE_VALUE, duplicate value found: <unknown> duplicates value on record with id: <unknown>: []

(npsp)






: []

Any help would be really really appreciated.

I checked other post from Stackexcahnge as well and tried work around but no luck yet.
Stack excahnge similar issue link - https://salesforce.stackexchange.com/questions/79799/how-to-debug-the-mysterious-duplicate-value-found-unknown-duplicates-value-o


--
Kind Regards
Mustafa
This field then needs to display as a merge field on an Opportunity Email Template.

E.g. opp 1 - total order amount (across 2 orders in this FY) = $3000
        opp 2 - total order amount (across 1 order in this FY) = $1000
       Field should display $4000 as it's look across all orders for the whole Organisation.

 Also, how do I set the formula up so that it will only display the correct detail for this FY and how do I set it up for subsequent FYs, or will the formula have be changed each year?

Cheers,
Nicola.
Hi ,
we need to send case for submit for approval.
User perspective :
when he click on submit for appproval, User need to able select list approvers to appprove.
1.  it need to multipule user and if he selected 2 approvers both approvers need to approver case.
2. Submitter has to ablilty recall for submission

How can we acheive it ?
Thanks for advance !!

Regards,
Bhanu
Hi,
in Salesforce lightning in files or Notes/Attachments of a contact or account you can see a preview of the first page from a stored pdf.
How is that possible?

Here is the code which I extract from the page.
<img src="https://DOMAIN.content.force.com/sfc/servlet.shepherd/version/renditionDownload?rendition=THUMB120BY90&amp;versionId=0688E00000091mE&amp;operationContext=CHATTER&amp;contentId=05T8E0000009v54" class="thumbnailImg medium" alt="PDF">

Screenshot:
User-added image

Thanks,
Sascha
I have a 17GB PST file which seems to be corrupt, I repaired my PST with ScanPST.exe but did not get all my data. Please give suggestion how can I repair my PST file its very important for me. 
Hi,
Is there a way to create a custom email button something in lines of below but this button can be on account, opportunity or lead. Is there a way to dynamically fetch the id of the record where the button is. For example if the below button is on Lead then the URL parameter should determine p3_lkid={!Lead.Id}, p4={!Lead.OwnerEmail}, etc. And also can it pass it over to the email template.

'/email/author/emailauthor.jsp?p2_lkid={!Contact.Id}&p4={!Opportunity.OwnerEmail}&rtype=003&p3_lkid={!Opportunity.Id}&template_id=00X30000000eCGt&retURL=/{!Opportunity.Id}'

Thank You
I have an integration that a customer is using and they are getting this error when trying to create a record:
"Unable to create/update fields: app__Status__c, app__ReferenceNum__c. 
 Please check the security settings of this field and verify that it is read/write 
 for your profile or permission set.\",\
 "errorCode\":\"INVALID_FIELD_FOR_INSERT_UPDATE\",\"
 fields\":[\"app__Status__c\",\"app__ReferenceNum__c\"]}]"


I cannot reproduce this error no matter how I change my permissions and settings. None of the posts about INVALID_FIELD_FOR_INSERT_UPDATE seem to be related to this issue.

I'm creating it with the ruby gem as follows
client.create('app__Idea__c', Name: xxx, 
        app__ReferenceNum__c: xxx, app__Status__c: xxx)
What is causing this error and or how can I recreate it?

Thanks
Hi All,

I have two picklist fields in vf page, i want to retain field dependency between the two in my page. I am using standard controller and no pageblock component used. Any ideas?

Thanks.
Hello Everyone I am new to Jquery and I have got a requirement to crate a list which could be sorted by drag and drop. Initially my plan was to get the order number using the positions but this method was not helpful becuase in differant related lists it has differant order number. So my only option is to get the Id of the updated record. I have tried many things but i am not able to get the Id as i should try some dynamic method. Would be great if anyone could guide me on how to get the Id. I have added my Visualforce and jquery code below.
 
<apex:page controller="DragController" >
    <head>
        <meta charset="utf-8"/>
        <meta name="viewport" content="width=device-width, initial-scale=1"/>
        <title>jQuery UI Sortable - Default functionality</title>
        <link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css"/>
        <link rel="stylesheet" href="/resources/demos/style.css"/>
        <style>
            #sortable { list-style-type: none; margin: 0; padding: 0; width: 60%; }
            #sortable li { margin: 0 3px 3px 3px; padding: 0.4em; padding-left: 1.5em; font-size: 1.4em; height: 35px; }
            #sortable li span { position: absolute; margin-left: -1.3em; }
        </style>
        <script src="https://code.jquery.com/jquery-1.12.4.js"></script>
        <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
        <script>
        $( function() {
            $( "#sortable" ).sortable({
                start: function(event, ui) {

                    var start_pos = ui.item.index();
                    ui.item.data('start_pos', start_pos);
                    
                },
                change: function(event, ui) {
                    var start_pos = ui.item.data('start_pos');

                    if (start_pos < index) {
                        $('#sortable li:nth-child(' + index + ')').addClass('highlights');
                    } else {
                        $('#sortable li:eq(' + (index + 1) + ')').addClass('highlights');
                    }
                },
                update: function(event, ui) {
                    var start_pos = ui.item.data('start_pos');
                    var end_pos = ui.item.index();
                    var order_number = end_pos+1;
                    var fnumber = start_pos+1;
                    var test = $('#test').attr('name'); 

                    alert ("starting order "+fnumber);
                    alert ("Ending order "+order_number);
                    alert (test);
          
                    startingOrder(fnumber);
               
                    $('#sortable li').removeClass('highlights');
                }   
                
            });
            
            $( "#sortable" ).disableSelection();
            
        } );        
        
        </script>
    </head>
    <body>
        <apex:form id="form">
      
            <ul id="sortable">
                <apex:repeat value="{!Accounts}" var="acc">
                    
                    <li class="ui-state-default" id="{!acc.id}"   >
                        <span id="test" name="{!acc.id}">{!acc.id}</span></li>
                </apex:repeat>
                
                <apex:actionFunction action="{!updateOrder}" name="startingOrder" reRender="form" > 
                    <apex:param name="param1" value="{!starting_order}"/> 
                </apex:actionFunction>
                
            </ul> 
        </apex:form>        
    </body>    
</apex:page>

 
Hi All, 

I have a scenario,
a Lead is created with "Marketing User" owner.
then if  a lead owner is changed to anyone other than "Marketing User"  and if the MF picklist value is Raw lead, then do Field update on the picklist to  MQL.
I wrote a WF, 
when a lead is created or edited to meet subsequent crietria  ( true) ,
In formula ,
AND( OwnerId  <> "005U0000005UxG7",  ISPICKVAL( Marketing_Funnel__c , 'Raw Lead') ) then do FU on picklist to MQL.

It is not firing when lead owner is changed  with link "change lead owner". After lead owner is changed to someone else , open lead record and save. then it is checking if owner is not marketing user and if picklist is Raw lead and then Updating picklist to MQL.

I need it to update when the lead owner is changed with "change lead owner"  and hit save. what am i dping wrong?
so i edited my formula to,
AND( ISCHANGED( OwnerId ), OwnerId  <> "005U0000005UxG7",  ISPICKVAL( Marketing_Funnel__c , 'Raw Lead') )
I get "Error: Function ISCHANGED may not be used in this type of formula". Any suggestions please.

  
when do we go for action function tell me 2 scenarios
Hi,

I'm having issues with some PB and wondering if doing something wrong.

When building a Scheduled Action in pb, it gives 2 options. 1- x Days after "Date Field", or 2- X Days from now

What does Now represents?

Is ti the equivalent of workflow "X Days after rule trigger date"?

Or Now = moment i created PB?

Or something else?

Looked everywhere and nowhere seems to explain this clearly

Thx

Hi All, 

I'm trying to complete the Process automation trail -> completeing the task "Automate sets of delayed actions with workflow" I made a couple of errors my first attempt - and deleted the workflow. The problem is I have also deleted the unique identifier that trail head uses to mark the test. Is there any way to get that unique identifier back or resolve this issue to complete the activity? 

thank you in advance, 
Steph 

hI friends,
pop up is not working on my vf page properly.
actually i am working on pageblock table,if the size of pageblock table is higher then the pop up is changed accordingly.if that is low,it changes.
based on back ground scroll bar,the pop up chenges automatically.
so please find this solution.
 
When I click "Save to server", I am getting one error like this for each class.

Save error: invalid cross reference id

I do not use any object by id in the code. Same of the classes are emtpy. I have used "refresh from server" followed by "save to server" multiple times and the list of error appears again.

User-added image
Hello,

Just a little background on my situation, I'm a new Admin/Developer for Salesforce, my company recently started using Salesforce and I'm trying to fulfill all the needs as they come. I have NOT had the time to go through any formal trainning on Salesforce Admin/Dev, I do have .Net programming experience though.

What I need help with is an issue with downloading Files/Attachments from an Opportunity, currently we have users that will upload 5-15 PDF's to an Opportunity and a different user will need to download all the files to process them in another system. Currently I don't see any way to "Download All Files" so the users have been downloading them one at a time and when they have 5-10 different Opportunities like this it becomes a time consuming task.

I have been tasked with finding an efficent way to download all the files/attachments, to accomplish this task I was trying to access the attachments from Apex so I could work with them programmically. Currently I can't even get that to work, everything I try returns zero rows, so this is how I was trying to access those Files/Attachments. Again I am very new, so feel free to suggest better methods to accomplish this task! 

string opportunityId = '0018000000M34fSfdsfS';
List<Attachment> attList = [Select Id, Name FROM Attachment WHERE ParentId =: opportunityId];

I know the Opportunity has Files that I can view but still the query returns zero rows. I also tried some combinations of CombinedAttachments and ContentDocument but still struggling, any help would be greatly appreciated! 
I am calling a batch through a system.scheduleBatch(BatchableClass(query), 'Job Name', MinutesToExecute) method. How can I check if the batch job Job Name is already scheduled?

Thanks in advance.