-
ChatterFeed
-
0Best Answers
-
1Likes Received
-
0Likes Given
-
17Questions
-
24Replies
Pattern and Mattcher in Unit Test
i am usising Pattern and Matcher Functions in class and need some direction to cover that part of the code in unit test. i am unable to cover the below code.
{ if(mapOrpIdWithContentId.get(r.Orphan__c)!= null) { Matcher MatcherOrpPicture = PatternOrpPicture.matcher(CV_FileName.title+'.'+CV_FileName.FileExtension); if (MatcherOrpPicture.matches()) { r.Orphan_Image__c = SetImageURL + mapOrpIdWithContentId.get(r.Orphan__c); updateReports.add(r);
thanks in Advance
-
- ArrgHunter
- February 14, 2020
- Like
- 0
- Continue reading or reply
exposing Salesforce data to our partner websites
I have a requirement, where I want to expose Salesforce custom object's data to our partner websites. Our partners websites are based on different platforms i.e. .Net, PHP and/or simple HTML websites. Out partners want to show updated stats from our salesforce system to their websites. In the first phase it will be a one way communication. Web sites request for info (on page load etc ) and salesforce will send stats.
Please give me your recommends on how to best approach this solution. What methodology shall I use.
Thanks in advance.
Regards,
-
- ArrgHunter
- December 02, 2014
- Like
- 0
- Continue reading or reply
Duplicate in list. Any suggestions?
i am geting this error when i attch an image to master object (in file and attchments) and the detail object have records.i am also updating master object when a new detail record is added and approved.
it seems that adding an image trigers the loop.
Error: Apex trigger trgOrphanImage caused an unexpected exception, contact your administrator: trgOrphanImage: execution of AfterInsert caused by: System.DmlException: Update failed. First exception on row 0 with id a0H2000000A5UtqEAF; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, trgAnnualProgressReportIns: execution of AfterUpdate caused by: System.ListException: Duplicate id in list: a0A2000000KkOr2EAF Class.AnnualReportUpdBiodata.updBiodata: line 96, column 1 Trigger.trgAnnualProgressReportIns: line 49, column 1: []: Trigger.trgOrphanImage: line 59, column 1
-
- ArrgHunter
- November 10, 2014
- Like
- 0
- Continue reading or reply
Capturing last saved records fields before adding new one
Any suggestions on how i can capture last saved records fields before new record gets saved or if there any better way to achieve this.
thanks in advance...
-
- ArrgHunter
- August 06, 2014
- Like
- 0
- Continue reading or reply
System.QueryException: Non-selective query against large object type
error details
ystem.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, trgAnnualProgressReportIns: execution of AfterInsert caused by: System.QueryException: Non-selective query against large object type (more than 100000 rows). Consider an indexed filter or contact salesforce.com about custom indexing. Even if a field is indexed a filter might still not be selective when: 1. The filter value includes null (for instance binding with a list that contains null) 2. Data skew exists whereby the number of matching rows is very large (for instance, filtering for a particular foreign key value that occurs many times) Trigger.trgAnnualProgressReportIns: line 47, column 1: []
Stack Trace: Class.testtrgAnnualProgressReportInsMethods.testAnnualProgressReportIns: line 139, column 1
Code for Trigger.trgAnnualProgressReportIns: line 47, column 1
for(Annual_Progress_Report__c a:[select id,APR_Education_Current__c, APR_Living_Current__c,APR_Health_Current__c from Annual_Progress_Report__c where Status__c = 'Approved' order by name desc Limit 1])
code for Class.testtrgAnnualProgressReportInsMethods.testAnnualProgressReportIns: line 139, column 1
Insert testAPR1;
any idea how can i tackle this issue
-
- ArrgHunter
- August 05, 2014
- Like
- 0
- Continue reading or reply
Need help with Trigger Rewrite
i wrote code some time ago in a trigger but now trying to move it to a class but hitting some errors. any help wll be greatly appreciated.
Aim is to copy the last report's field values to newly created one with in same object.
Code i wrote for trigger and it works fine.
trigger trgUpdateAPR on Annual_Progress_Report__c (after insert) {
Integer HealthSc = 0;
Integer EducationSc = 0;
Integer LivingSc = 0;
Integer Flag = 0;
//get previous year value
list<Annual_Progress_Report__c> lstname=new list<Annual_Progress_Report__c>();
for(Annual_Progress_Report__c a:[select id,APR_Education_progress_current_year__c,APR_Health_progress_current_year__c,APR_Living_progress_current_year__c from Annual_Progress_Report__c where Status__c = 'Approved' order by name desc Limit 1])
{
flag = flag +1;
system.debug ('Health Score::-' + a.Health_assessment_progress_score__c);
// Assign value to temp variable
EducationSc = Integer.valueOf(a.APR_Education_progress_current_year__c);
LivingSc = Integer.valueOf(a.APR_Living_progress_current_year__c);
HealthSc = Integer.valueOf(a.APR_Health_progress_current_year__c);
}
Annual_Progress_Report__c APR=trigger.new[0];
Annual_Progress_Report__c updRP=[select id from Annual_Progress_Report__c where id = :APR.id];
updRP.APR_Education_progress_last_year__c= EducationSc;
updRP.APR_Living_progress_last_year__c= LivingSc;
updRP.APR_Health_progress_last_year__c= HealthSc;
//update the new value
update updRP;
}
i have created a method that is being called by a trigger.
public void copyPreviousAPR(list<Annual_Progress_Report__c> triggernew){
Integer HealthSc = 0;
Integer EducationSc = 0;
Integer LivingSc = 0;
Integer Flag = 0;
//get previous year value
//list<Annual_Progress_Report__c> lstname=new list<Annual_Progress_Report__c>();
for(Annual_Progress_Report__c a:[select id,APR_Education_Current__c from Annual_Progress_Report__c where Status__c = 'Approved' order by name desc Limit 1])
{
system.debug ('DBG- Education Score:: ' + a.APR_Education_Current__c);
// Assign value to temp variable
EducationSc = Integer.valueOf(a.APR_Education_Current__c);
//LivingSc = Integer.valueOf(a.APR_Living_progress_current_year__c);
//HealthSc = Integer.valueOf(a.APR_Health_progress_current_year__c);
}
Annual_Progress_Report__c APR = trigger.new[0];
Annual_Progress_Report__c updRP=[select id from Annual_Progress_Report__c where id = :APR.id];
updRP.APR_Education_Previous__c= EducationSc;
//updRP.APR_Living_progress_last_year__c= LivingSc;
//updRP.APR_Health_progress_last_year__c= HealthSc;
//update the new value
update updRP;
}
i am having problem with these 2 lines
Annual_Progress_Report__c APR = trigger.new[0];
Annual_Progress_Report__c updRP=[select id from Annual_Progress_Report__c where id = :APR.id];
can someone help me to rewrite these 2 lines.
thanks,
-
- ArrgHunter
- July 09, 2014
- Like
- 0
- Continue reading or reply
Internal Server Error 1570591640-80446 (557561208)
Can some one please translate this error code for me. i have no clue why SF is throwing this error.
i am getting this error when try to find our code coverage by clicking on "Estimate your organization's code coverage".
i appreciate any help.
Regards,
Thanks,
-
- ArrgHunter
- May 02, 2014
- Like
- 0
- Continue reading or reply
CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, Trigger: execution of AfterInsert
i need some expert brain here to pin point me towards right direction.
i am getting this error when i "RUN ALL TESTS". full detail of error as below
Error Message System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, trgOrphanId: execution of AfterInsert
caused by: System.QueryException: Record Currently Unavailable: The record you are attempting to edit, or one of its related records, is currently being modified by another user. Please try again.
Trigger.trgOrphanId: line 23, column 1: []
Stack Trace Class.testBulkAllocateOrphans.myUnitTest: line 33, column 1
the code coverage at the moment is 15%.
would appreciate any feedback.
Thanks in advacne.
-
- ArrgHunter
- March 28, 2014
- Like
- 0
- Continue reading or reply
Email alerts based on record status
hi everyone,
i have a requirement where system send 3 email alerts to the owner of the record if a record (in custom ) is created in the system and record's status remains same for a week.
if after a week, the status of the record is still the same, i want to fire 3 email alerts each after a day to alert owner of the record.
i have tried time based workflow rule with 3 time depended actions. but it seems that if the criteria met at the time of creation of the records, the time based actions get queued and if the record status gets changed the next day, system still fire email alert.
need solution and don't want to write code.
thanks,
thanks,
-
- ArrgHunter
- February 03, 2014
- Like
- 1
- Continue reading or reply
code improvement
Hi Guys,
i wrote a trigger which is doing the job and i want to know if there is a room to improve the code.
trigger aprUpdate on Annual_Progress_Report__c (after insert) {
Integer SC = 0;
//get previous month/year value
list<Annual_Progress_Report__c> lstname=new list<Annual_Progress_Report__c>();
for(Annual_Progress_Report__c a:[select id, Health_assessment_progress_score__c from Annual_Progress_Report__c order by id desc Limit 2])
{
// Assign value to temp variable
SC = Integer.valueOf(a.Health_assessment_progress_score__c);
}
Annual_Progress_Report__c APR=trigger.new[0];
Annual_Progress_Report__c updRP=[select id from Annual_Progress_Report__c where id = :APR.id];
updRP.Health_assessment_progress_score2__c= SC;
//update the new value
update updRP;
}
thanks,
-
- ArrgHunter
- August 23, 2013
- Like
- 0
- Continue reading or reply
on insert wants to copy values from previous record
Hi guys,
I need opinion on how I can achieve the required functionality.
I have a custom object A that stores user progress details every month. When a new record is added next month I want to copy user’s previous month’s scorer to newly added record. I nut shall I want to have users previous month’s score into the current month record in custom field.
Am I right to think that I need before insert trigger to achieve it. But don’t know how I can save previous month’s score in the trigger temporarily and then added to new record. Any help?
Thanks,
-
- ArrgHunter
- August 20, 2013
- Like
- 0
- Continue reading or reply
Updating a custom field with mater-detail relationship
Hi guys,
I need help to update a custom field. I have two custom objects A and B with mater details relationship and both have education progress field. Every time When a new record is added to object B , i want to insert objects B’s (education progress fields) value into Object A’s education progress field and it will concatenate values with comma. Object A have one-to-many relationship with Object B.
Please suggest best way to achieve this.
Thanks in advance.
Regards,
-
- ArrgHunter
- August 20, 2013
- Like
- 0
- Continue reading or reply
custom field not getting updated
Hi,
i have created custom controller and want to update a custom field with value based on the button user clicked on the vf page.
somehow my field is not being updated. any help will be appreciated as i have spent lot of time on it but unable to fix it.
it will be big help for a charity.
public class IRPTemplateSelection { public IRPTemplateSelection(){ } public PageReference TemplateSelection() { System.currentPageReference().getParameters().get('Templateid'); try { Orphan__c MyOrp = new Orphan__c(); String TemplateId = Apexpages.currentPage().getParameters().get('Templateid'); if (TemplateId != '') {myorp.Biodata_Report_Template_4_Conductor__c = TemplateId;} else {myorp.Biodata_Report_Template_4_Conductor__c = 'a0JP0000001qGwU';} update (myorp); } catch(System.DMLException e) { ApexPages.addMessages(e); return null; } PageReference pageRef = new PageReference('https://cs4.salesforce.com/a0A?fcf=00B20000005raAO'); pageRef.setRedirect(false); return pageRef; } }
<apex:page controller="IRPTemplateSelection" title="Template Selection" id="Templateselectionpage" > <!-- Begin Default Content REMOVE THIS --> <h1>Biodata Template Selection</h1> <apex:form id="allocOrphansForm" > <apex:outputPanel > <apex:pageBlock id="resultsBlock"> <apex:pageBlockButtons > <apex:commandButton title="Select BioData Template" value="English BioData Template" action="{!TemplateSelection}" /> <apex:param name="Templateid" value="a0JP0000001qGwU" /> </apex:pageBlockButtons> <apex:pageBlockButtons > <apex:commandButton title="Select BioData Template" value="Arabic BioData Template" action="{!TemplateSelection}"/> <apex:param name="Templateid" value="a0JP0000001q86Q" /> </apex:pageBlockButtons> <apex:facet name="header">Choose Template</apex:facet> <apex:outputText value="template"> <apex:param value="test template" /> </apex:outputText> </apex:pageBlock> <apex:pageBlock title="Simple Title"> <b>Hello <i>{!$User.FirstName} {!$User.Country}</i></b> { if {!$User.Country} } </apex:pageBlock> </apex:outputPanel> </apex:form> <!-- End Default Content REMOVE THIS --> </apex:page>
code is as below.
thanks
-
- ArrgHunter
- December 01, 2011
- Like
- 0
- Continue reading or reply
complier error in string assignment.
Hi,
i am trying to assign a string value to text type custom field on line 7 but getting the complier error "Expression cannot be assigned "
any idea what i am missing?
thanks,
ublic class IRPTemplateSelection { public PageReference TemplateSelection() { // String TemplateId = 'a0JP0000001qGwU'; String TemplateId = System.currentPageReference().getParameters().get('Templateid'); Orphan__c.Biodata_Report_Template_4_Conductor__c = TemplateId ; PageReference pageRef = new PageReference('https://cs4.salesforce.com/a0A?fcf=00B20000005raAO' ); pageRef.setRedirect(true); return pageRef; } }
-
- ArrgHunter
- November 30, 2011
- Like
- 0
- Continue reading or reply
Updating custom field in visualforce page
I have built a visualforce page with custom controller. On my vf page I have 3 buttons. I want to update a custom field when a user clicks on one of the buttons and then want to redirect the user to different page.
Any idea what is the best way to achieve this.
Thanks,
//My custom controller class public class IRPTemplateSelection { public PageReference TemplateSelection() { String TemplateId = ApexPages.currentPage().getParameters().get('Templateid'); if (TemplateId == 'a0JP0000001qGwU') {Orphan__c.Biodata_Report_Template__c = 'a0JP0000001qGwU';} else if (TemplateId == 'a0JP0000001q86Q') {Orphan__c.Biodata_Report_Template__c = 'a0JP0000001q86Q';} else {Orphan__c.Biodata_Report_Template__c = 'a0JP0000001q86Q';} PageReference pageRef = new PageReference('https://cs4.salesforce.com/a0A?fcf=00B20000005raAO' ); pageRef.setRedirect(true); return pageRef; } }
VF Page <apex:page controller="IRPTemplateSelection" title="Template Selection" id="Templateselectionpage"> <!-- Begin Default Content REMOVE THIS --> <h1>Biodata Template Selection</h1> <apex:form id="allocOrphansForm" > <apex:outputPanel > <apex:pageBlock id="resultsBlock"> <apex:pageBlockButtons > <apex:commandButton title="Select BioData Template" value="English BioData Template" /> <apex:param name="Templateid" value="a0JP0000001qGwU" /> </apex:pageBlockButtons> <apex:pageBlockButtons > <apex:commandButton title="Select BioData Template" value="Arabic BioData Template" /> <apex:param name="Templateid2" value="a0JP0000001q86Q" /> </apex:pageBlockButtons> <apex:facet name="header">Choose Template</apex:facet> <apex:outputText value="template"> <apex:param value="test template" /> </apex:outputText> </apex:pageBlock> <apex:pageBlock title="Simple Title"> <b>Hello <i>{!$User.FirstName}</i>.</b> </apex:pageBlock> </apex:outputPanel> </apex:form> <!-- End Default Content REMOVE THIS --> </apex:page>
-
- ArrgHunter
- November 03, 2011
- Like
- 0
- Continue reading or reply
Insert failed. First exception on row 12; first error: INVALID_CROSS_REFERENCE_KEY, Owner ID:
Hi,
i have a class that i run from system log screen ervery month. it was working fine but all of a suddon it has started giving errors as below.
*********************************** Error Log******************************
Apex script unhandled exception by user/organization: 00520000001grzo/00D20000000BaRL
Failed to process batch for class 'clsInvoiceRun' for job id '7072000000AspWh'
caused by: System.DmlException: Insert failed. First exception on row 12; first error: INVALID_CROSS_REFERENCE_KEY, Owner ID: owner cannot be blank: [OwnerId]
Class.clsInvoiceRun.execute: line 180, column 9
External entry point
Debug Log:
6 (476287000)|SYSTEM_METHOD_ENTRY|[163]|MAP.containsKey(ANY)
14:53:05.476 (476365000)|SYSTEM_METHOD_EXIT|[163]|MAP.containsKey(ANY)
14:53:05.476 (476400000)|STATEMENT_EXECUTE|[163]
14:53:05.476 (476458000)|VARIABLE_ASSIGNMENT|[161]|i|103
14:53:05.476
.
.
.long list continue.....
.
.
14:53:05.818 (818405000)|WF_RULE_FILTER|[Invoice : Invoice Status equals Finance Approved]
AND [Invoice : Record Type equals Invoice Stage 2]
14:53:05.818 (818527000)|WF_RULE_EVAL_VALUE|1
14:53:05.818 (818595000)|WF_CRITERIA_END|false
14:53:05.818 (818681000)|WF_SPOOL_ACTION_BEGIN|Workflow
14:53:05.818 (818828000)|WF_ACTION| None
14:53:05.818 (818897000)|WF_RULE_EVAL_BEGIN|Escalation
14:53:05.818 (818960000)|WF_RULE_EVAL_END
14:53:05.819 (819194000)|WF_ACTIONS_END| None
14:53:05.819 (819278000)|CODE_UNIT_FINISHED|Workflow:01I20000000cVKI
14:53:05.820 (820086000)|DML_END|[180]
any help will be appriciated
thanks,
-
- ArrgHunter
- October 25, 2011
- Like
- 0
- Continue reading or reply
Calculating attachment size in tigger
Hi,
i am trying to limit the attachment size to 2 MB through a trigger.it seems like not calculating correct size. i want to limit the users so that they only able to upload files less than 2 MB in size.
i am trying with following code
trigger trgCheckFileSize on Attachment (after insert) {
list<Attachment> att = new List<Attachment>();
for (Attachment a : Trigger.new) { att.add(a); }
integer sizecheck = att.get(0).body.size();
if (sizecheck > 2097152){
att.get(0).addError('max size 1 Mb: you are trying file size ' + String.Valueof(sizecheck)); }
}
any idea why its not calculating the correct size.
ps: for file size 8kb, i am getting body size 8098.
thanks,
-
- ArrgHunter
- August 11, 2011
- Like
- 0
- Continue reading or reply
Email alerts based on record status
hi everyone,
i have a requirement where system send 3 email alerts to the owner of the record if a record (in custom ) is created in the system and record's status remains same for a week.
if after a week, the status of the record is still the same, i want to fire 3 email alerts each after a day to alert owner of the record.
i have tried time based workflow rule with 3 time depended actions. but it seems that if the criteria met at the time of creation of the records, the time based actions get queued and if the record status gets changed the next day, system still fire email alert.
need solution and don't want to write code.
thanks,
thanks,
-
- ArrgHunter
- February 03, 2014
- Like
- 1
- Continue reading or reply
exposing Salesforce data to our partner websites
I have a requirement, where I want to expose Salesforce custom object's data to our partner websites. Our partners websites are based on different platforms i.e. .Net, PHP and/or simple HTML websites. Out partners want to show updated stats from our salesforce system to their websites. In the first phase it will be a one way communication. Web sites request for info (on page load etc ) and salesforce will send stats.
Please give me your recommends on how to best approach this solution. What methodology shall I use.
Thanks in advance.
Regards,
- ArrgHunter
- December 02, 2014
- Like
- 0
- Continue reading or reply
Capturing last saved records fields before adding new one
Any suggestions on how i can capture last saved records fields before new record gets saved or if there any better way to achieve this.
thanks in advance...
- ArrgHunter
- August 06, 2014
- Like
- 0
- Continue reading or reply
I am not able to deploy my change set to production
I am not able to deploy my change set to production my overall code coverage in sandbox is 90+% but when i deploy it to production it give me code coverage error and says my over all code coverage is 69%
I have include only one class in my change set and its code coverage is 93% in sandbox and overall code coverage in sandbox is also 90+
Can any body help me?
Thanks in advance.
- Shahab Khan
- August 06, 2014
- Like
- 0
- Continue reading or reply
System.QueryException: Non-selective query against large object type
error details
ystem.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, trgAnnualProgressReportIns: execution of AfterInsert caused by: System.QueryException: Non-selective query against large object type (more than 100000 rows). Consider an indexed filter or contact salesforce.com about custom indexing. Even if a field is indexed a filter might still not be selective when: 1. The filter value includes null (for instance binding with a list that contains null) 2. Data skew exists whereby the number of matching rows is very large (for instance, filtering for a particular foreign key value that occurs many times) Trigger.trgAnnualProgressReportIns: line 47, column 1: []
Stack Trace: Class.testtrgAnnualProgressReportInsMethods.testAnnualProgressReportIns: line 139, column 1
Code for Trigger.trgAnnualProgressReportIns: line 47, column 1
for(Annual_Progress_Report__c a:[select id,APR_Education_Current__c, APR_Living_Current__c,APR_Health_Current__c from Annual_Progress_Report__c where Status__c = 'Approved' order by name desc Limit 1])
code for Class.testtrgAnnualProgressReportInsMethods.testAnnualProgressReportIns: line 139, column 1
Insert testAPR1;
any idea how can i tackle this issue
- ArrgHunter
- August 05, 2014
- Like
- 0
- Continue reading or reply
Need help with Trigger Rewrite
i wrote code some time ago in a trigger but now trying to move it to a class but hitting some errors. any help wll be greatly appreciated.
Aim is to copy the last report's field values to newly created one with in same object.
Code i wrote for trigger and it works fine.
trigger trgUpdateAPR on Annual_Progress_Report__c (after insert) {
Integer HealthSc = 0;
Integer EducationSc = 0;
Integer LivingSc = 0;
Integer Flag = 0;
//get previous year value
list<Annual_Progress_Report__c> lstname=new list<Annual_Progress_Report__c>();
for(Annual_Progress_Report__c a:[select id,APR_Education_progress_current_year__c,APR_Health_progress_current_year__c,APR_Living_progress_current_year__c from Annual_Progress_Report__c where Status__c = 'Approved' order by name desc Limit 1])
{
flag = flag +1;
system.debug ('Health Score::-' + a.Health_assessment_progress_score__c);
// Assign value to temp variable
EducationSc = Integer.valueOf(a.APR_Education_progress_current_year__c);
LivingSc = Integer.valueOf(a.APR_Living_progress_current_year__c);
HealthSc = Integer.valueOf(a.APR_Health_progress_current_year__c);
}
Annual_Progress_Report__c APR=trigger.new[0];
Annual_Progress_Report__c updRP=[select id from Annual_Progress_Report__c where id = :APR.id];
updRP.APR_Education_progress_last_year__c= EducationSc;
updRP.APR_Living_progress_last_year__c= LivingSc;
updRP.APR_Health_progress_last_year__c= HealthSc;
//update the new value
update updRP;
}
i have created a method that is being called by a trigger.
public void copyPreviousAPR(list<Annual_Progress_Report__c> triggernew){
Integer HealthSc = 0;
Integer EducationSc = 0;
Integer LivingSc = 0;
Integer Flag = 0;
//get previous year value
//list<Annual_Progress_Report__c> lstname=new list<Annual_Progress_Report__c>();
for(Annual_Progress_Report__c a:[select id,APR_Education_Current__c from Annual_Progress_Report__c where Status__c = 'Approved' order by name desc Limit 1])
{
system.debug ('DBG- Education Score:: ' + a.APR_Education_Current__c);
// Assign value to temp variable
EducationSc = Integer.valueOf(a.APR_Education_Current__c);
//LivingSc = Integer.valueOf(a.APR_Living_progress_current_year__c);
//HealthSc = Integer.valueOf(a.APR_Health_progress_current_year__c);
}
Annual_Progress_Report__c APR = trigger.new[0];
Annual_Progress_Report__c updRP=[select id from Annual_Progress_Report__c where id = :APR.id];
updRP.APR_Education_Previous__c= EducationSc;
//updRP.APR_Living_progress_last_year__c= LivingSc;
//updRP.APR_Health_progress_last_year__c= HealthSc;
//update the new value
update updRP;
}
i am having problem with these 2 lines
Annual_Progress_Report__c APR = trigger.new[0];
Annual_Progress_Report__c updRP=[select id from Annual_Progress_Report__c where id = :APR.id];
can someone help me to rewrite these 2 lines.
thanks,
- ArrgHunter
- July 09, 2014
- Like
- 0
- Continue reading or reply
Internal Server Error 1570591640-80446 (557561208)
Can some one please translate this error code for me. i have no clue why SF is throwing this error.
i am getting this error when try to find our code coverage by clicking on "Estimate your organization's code coverage".
i appreciate any help.
Regards,
Thanks,
- ArrgHunter
- May 02, 2014
- Like
- 0
- Continue reading or reply
CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, Trigger: execution of AfterInsert
i need some expert brain here to pin point me towards right direction.
i am getting this error when i "RUN ALL TESTS". full detail of error as below
Error Message System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, trgOrphanId: execution of AfterInsert
caused by: System.QueryException: Record Currently Unavailable: The record you are attempting to edit, or one of its related records, is currently being modified by another user. Please try again.
Trigger.trgOrphanId: line 23, column 1: []
Stack Trace Class.testBulkAllocateOrphans.myUnitTest: line 33, column 1
the code coverage at the moment is 15%.
would appreciate any feedback.
Thanks in advacne.
- ArrgHunter
- March 28, 2014
- Like
- 0
- Continue reading or reply
Email alerts based on record status
hi everyone,
i have a requirement where system send 3 email alerts to the owner of the record if a record (in custom ) is created in the system and record's status remains same for a week.
if after a week, the status of the record is still the same, i want to fire 3 email alerts each after a day to alert owner of the record.
i have tried time based workflow rule with 3 time depended actions. but it seems that if the criteria met at the time of creation of the records, the time based actions get queued and if the record status gets changed the next day, system still fire email alert.
need solution and don't want to write code.
thanks,
thanks,
- ArrgHunter
- February 03, 2014
- Like
- 1
- Continue reading or reply
code improvement
Hi Guys,
i wrote a trigger which is doing the job and i want to know if there is a room to improve the code.
trigger aprUpdate on Annual_Progress_Report__c (after insert) {
Integer SC = 0;
//get previous month/year value
list<Annual_Progress_Report__c> lstname=new list<Annual_Progress_Report__c>();
for(Annual_Progress_Report__c a:[select id, Health_assessment_progress_score__c from Annual_Progress_Report__c order by id desc Limit 2])
{
// Assign value to temp variable
SC = Integer.valueOf(a.Health_assessment_progress_score__c);
}
Annual_Progress_Report__c APR=trigger.new[0];
Annual_Progress_Report__c updRP=[select id from Annual_Progress_Report__c where id = :APR.id];
updRP.Health_assessment_progress_score2__c= SC;
//update the new value
update updRP;
}
thanks,
- ArrgHunter
- August 23, 2013
- Like
- 0
- Continue reading or reply
on insert wants to copy values from previous record
Hi guys,
I need opinion on how I can achieve the required functionality.
I have a custom object A that stores user progress details every month. When a new record is added next month I want to copy user’s previous month’s scorer to newly added record. I nut shall I want to have users previous month’s score into the current month record in custom field.
Am I right to think that I need before insert trigger to achieve it. But don’t know how I can save previous month’s score in the trigger temporarily and then added to new record. Any help?
Thanks,
- ArrgHunter
- August 20, 2013
- Like
- 0
- Continue reading or reply
complier error in string assignment.
Hi,
i am trying to assign a string value to text type custom field on line 7 but getting the complier error "Expression cannot be assigned "
any idea what i am missing?
thanks,
ublic class IRPTemplateSelection { public PageReference TemplateSelection() { // String TemplateId = 'a0JP0000001qGwU'; String TemplateId = System.currentPageReference().getParameters().get('Templateid'); Orphan__c.Biodata_Report_Template_4_Conductor__c = TemplateId ; PageReference pageRef = new PageReference('https://cs4.salesforce.com/a0A?fcf=00B20000005raAO' ); pageRef.setRedirect(true); return pageRef; } }
- ArrgHunter
- November 30, 2011
- Like
- 0
- Continue reading or reply
Updating custom field in visualforce page
I have built a visualforce page with custom controller. On my vf page I have 3 buttons. I want to update a custom field when a user clicks on one of the buttons and then want to redirect the user to different page.
Any idea what is the best way to achieve this.
Thanks,
//My custom controller class public class IRPTemplateSelection { public PageReference TemplateSelection() { String TemplateId = ApexPages.currentPage().getParameters().get('Templateid'); if (TemplateId == 'a0JP0000001qGwU') {Orphan__c.Biodata_Report_Template__c = 'a0JP0000001qGwU';} else if (TemplateId == 'a0JP0000001q86Q') {Orphan__c.Biodata_Report_Template__c = 'a0JP0000001q86Q';} else {Orphan__c.Biodata_Report_Template__c = 'a0JP0000001q86Q';} PageReference pageRef = new PageReference('https://cs4.salesforce.com/a0A?fcf=00B20000005raAO' ); pageRef.setRedirect(true); return pageRef; } }
VF Page <apex:page controller="IRPTemplateSelection" title="Template Selection" id="Templateselectionpage"> <!-- Begin Default Content REMOVE THIS --> <h1>Biodata Template Selection</h1> <apex:form id="allocOrphansForm" > <apex:outputPanel > <apex:pageBlock id="resultsBlock"> <apex:pageBlockButtons > <apex:commandButton title="Select BioData Template" value="English BioData Template" /> <apex:param name="Templateid" value="a0JP0000001qGwU" /> </apex:pageBlockButtons> <apex:pageBlockButtons > <apex:commandButton title="Select BioData Template" value="Arabic BioData Template" /> <apex:param name="Templateid2" value="a0JP0000001q86Q" /> </apex:pageBlockButtons> <apex:facet name="header">Choose Template</apex:facet> <apex:outputText value="template"> <apex:param value="test template" /> </apex:outputText> </apex:pageBlock> <apex:pageBlock title="Simple Title"> <b>Hello <i>{!$User.FirstName}</i>.</b> </apex:pageBlock> </apex:outputPanel> </apex:form> <!-- End Default Content REMOVE THIS --> </apex:page>
- ArrgHunter
- November 03, 2011
- Like
- 0
- Continue reading or reply
unable to view dashboard for user a/c
Hi
1. I have created a report and saved that report in My Personal Report.
2. Then created a clone of that report and saved that in a new report folder(MY_Report_Folder)
3. Then i copied the clone report in new Dashboard (My_Dashboard_folder).
4. Last I created a force free user account.
Everything is working quite well.
From here the problem starts....
The new logged in user is able to view and run all the reports created by admin user.
But unable to view Dashboard. (The dashboard folder is visble in the logged in user)
Whenever I m trying to open dashboard it is displying.
Insufficient Privileges |
You do not have the level of access necessary to perform the operation you requested. Please contact the owner of the record or your administrator if access is necessary.
The credential set for the user are below.
Profile setting for the user are below
Name:-Test_clone
User License force.com free Custom profile (Checked) Custom App settings Sample App Volunteerforce (default) (Unchecked ) Overwrite users' personal tab customizations Tab Settings 1.Standers Tab Settings :->All Tab are Default On 2.Custom Tab Settings :->All Tab are Default On
Administrative Permission :->Everything is Checked General User Permission :-> Everything is Checked Standard Object Permission :->Everthing is Checked Custom Object Permission :-Everthing is Checked
Kindly help me. What m I Missing here…. |
- test.testing550
- June 08, 2010
- Like
- 0
- Continue reading or reply