-
ChatterFeed
-
2Best Answers
-
3Likes Received
-
0Likes Given
-
20Questions
-
38Replies
update Trigger to only update date if date field not equal to null
What I'd like to do is have this trigger update the Asset "Inactive_Date__c" with the Contract "End_Date__c" ONLY if Contract "End_Date__c" != null. That is, only if there is an End Date on the Contract should the Inactive Date on the Asset be updated. The Inactive Date should never be changed if the End Date on the Contract is 'null'.
Can anyone help me with this?
for(Asset a: [Select Contract__c, Contract__r.End_Date__c, Inactive_Date__c from Asset where Contract__c =: Trigger.newMap.keyset() ]) { System.debug('++++ querying associated assets' ); a.Inactive_Date__c = Trigger.newMap.get(a.Contract__c).End_Date__c; System.debug('++++ updating inactive date on assets with contract inactive date = ' + a.Inactive_Date__c); assetsToUpdate.add(a); }
Thanks,
Chris
-
- cbro
- August 27, 2013
- Like
- 0
- Continue reading or reply
Display sections based on checkboxes checked ?
Hi Everyone,
I would like to get some suggestions on how to display sections on a Visualforce page based on specific checkboxes selected.
here is the Question ?
i made a VF page in which i have to display 2 radio buttons
- Existing contacts ,
- New contacts ,
if i select the first one look up field should be displayed and the existing contact would be selected ,
if the second radio button clicked New fields should be displayed for creating the Contacts ,
how is this possible ? plz help
-
- SFDH
- August 27, 2013
- Like
- 0
- Continue reading or reply
Visualforce inserting blank space in place of <li> on apex:dataList
I have a page with some css. There is a <section> tag inside which I am displaying few items from a list using <apex:dataList>. My code works in such a way that when the page loads, one row and four columns of data are displayed on the page. There is a 'View More" link which user can click to load more data. Once I click on this link the result is loaded on some columns with simple blank spaces. There are no null values on the list so I am not sure where this blank is coming from. See below a sample screenshot of the issue.
Below is my code snippet.
<section data-tab='t-recent'> <apex:dataList value="{!displayContentMap}" var="res"> <img src="/{!displayContentMap[res].mainpagearticle.Id}"/> <h3>{!displayContentMap[res].dataCategory} | <apex:outputText value="{!displayContentMap[res].mainPageArticle.Display_Date__c}" /> </h3> <p><a href='/apex/Community_DetailPage?Id={!displayContentMap[res].mainPageArticle.knowledgearticleId}'>{!displayContentMap[res].mainPageArticle.Title}</a></p> </apex:dataList> <apex:outputPanel rendered="{!showViewMore}"> <div class='more'><apex:form ><apex:commandLink action="{!showView}" reRender="resultBlock" >View More</apex:commandLink></apex:form><div class='icn'></div></div> </apex:outputPanel> </section>
-
- Aneesha
- April 08, 2015
- Like
- 1
- Continue reading or reply
returning to list view from apex page
Am I doing something wrong here?
-
- Aneesha
- July 10, 2014
- Like
- 0
- Continue reading or reply
Too many username matches error while deploying dashboards
I am trying to deploy few reports and dashboards to a fullcopy sandbox 'fc' from another fullcopy sandbox via changeset and I am getting the following error message for dashboards.
Too many username matches for abc@gmail.com. The possible matches are abc@gmail.com.fc, abc@gmail.com; edit the username to match only one.
What des this mean?
-
- Aneesha
- June 06, 2014
- Like
- 0
- Continue reading or reply
user email update
Any ideas on what can be done?
-
- Aneesha
- May 11, 2014
- Like
- 0
- Continue reading or reply
Cannot find CollaborationGroupMember object in dataloader
-
- Aneesha
- April 16, 2014
- Like
- 1
- Continue reading or reply
Trigger.new[0].addError giving Insufficient Privileges error
I am getting Insufficient Privileges error while adding error messgae using addError. I have tried with System Admin profile but still the same issue.
The code works fine when I comment out the addError lines.
Does anyone know why this issue is happening?
-
- Aneesha
- March 27, 2014
- Like
- 0
- Continue reading or reply
rec.Owner.Name returning null in before update trigger
Can somebody help me understand what is the issue?
-
- Aneesha
- March 11, 2014
- Like
- 0
- Continue reading or reply
Help with page styling
Hi,
I am using a html pre tag to display some data in my page. This pre tag is used in a <td> element for a table. Now I need to rerender the page in word,excel and pdf. The page looks fine in word and excel. However in pdf the width of the page has increased. by about 20%. See my code snippet below.
<table> <tr> // some logic here <td width="30%"> <pre style="font-family: 'Arial';font-weight:bold"> Column2 Column3</pre> <pre style="font-family: 'Arial';word-wrap:break-word;"><b>Result</b> {!TotalTOP} {!TotalOOP}</pre> </td>
As you can see, the first pre tag has 2 words while the second pre tag has 3. The page is displayed correctly and is rendered correctly in word and excel. But in pdf, because of the extra word, the width of <td> is automatically increased from 30% to 50%. How do I keep the width at 30%.
-
- Aneesha
- October 26, 2013
- Like
- 0
- Continue reading or reply
Rerender a component outside apex:form
I have an apex:pageMessage component outside apex:form which I would like to rerender based on the action of a commandlink and commandbutton inside apex:form. I have placed the pagemessage inside an outputpanel an rerendered the panel using the id, but its not displaying the error message. I can see the error message in the logs. But its not displaying in the page. First of all, i am doing the right thin? Is it even possible to rerender this way?
If not how do i get to rerender the pagemessage component? I cannot put the component inside the form, because currently the form itself is rerendered based on the action of the commandlink and commandbutton.
-
- Aneesha
- October 23, 2013
- Like
- 0
- Continue reading or reply
Hiding reports from users
Hi,
I have some reports in my org which I only want some users to see. I have created a folder and a public group with those users and shared the folder with the group. It works fine for most of the users.However I found that some users were still able to access this reports. I mean they are not getting the Insufficient privileges error. They can see the report and edit the report. They are not seeing any data on the report.
Why is this happening? My guess is its a profile permission. But I cannot figure out which one.Can somebody please explain?
Thanks in advance.
-
- Aneesha
- September 06, 2013
- Like
- 0
- Continue reading or reply
Restricting List View visibility to certain groups
I have certain list views on the custom objects which I want only certain group of people to see. For example I have two list views LV1 and LV2. Certain group of users should only see LV1 and certain others should see only LV2.I have created two public groups and restricted the visibility to 'Certain groups' but still the users are able to see both the list views LV1 and LV2.
Upon investigation I found that the users have system permission 'Manage Public List Views' in their profile.
What can I do to restrict the users from viewing the list views they are not supposed to see?
-
- Aneesha
- August 27, 2013
- Like
- 1
- Continue reading or reply
Help with image rerender
I have a custom picklist and a dependant textbox on my page. I am using javascript function to populate the textbox with a value onchange of the picklist value. Now I want to rerender an image on the page whenever the value on the textbox is changed. How do i do that?
I have already tried using actionSupport with inputtext but no use.
<apex:pageBlockSectionItem > <apex:selectList style="width:100px; height:20px;margin-left:5px;" size="1" id="selectedFld" value="{!selectedValue}" onchange="javascript:updateSelectValue(this.id, this.value)"> <apex:selectOptions value="{!inputField.selectOptions}" /> </apex:selectList> <apex:outputPanel > <apex:image id="img" value="{!if(selectedValue=='0', "/resource/1373951589000/Field_mandatory", "")}" height="{!if(selectedValue=='0', "20", "0")}" width="{!if(selectedValue=='0', "2", "0")}" style="vertical-align:top;" /> <apex:inputText value="{!selectedValue}" id="selectedFldValue" title="{!hoverText}" style="width:80px;" rendered="{!if(hasOtherSelect, true, false)}"/> <!-- <apex:actionSupport event="onchange" rerender="img"/>--> </apex:outputPanel> </apex:pageBlockSectionItem>
-
- Aneesha
- August 10, 2013
- Like
- 0
- Continue reading or reply
Change set deployment status stuck in 'In Progress' for over 11 hours
Hi,
I was validating a change set which contains 71 components(custom fields,objects,recordtype ). In the middle of validation my session timed out and I was logged out of salesforce. I loged in again and after 20 mins the change set screen refreshed and now even after 11 hours the status is 'In Progress'. We have a lot of deployment to do this weekend. Can anyone help me wih any suggestions as to what needs to be done?
Will this lock my Organization from any further changes? I am planning to manually create the components. Can that be done or will I get 'Organization locked from further changes' error?
-
- Aneesha
- June 23, 2013
- Like
- 0
- Continue reading or reply
How to convert a comma seperated string into integer
Hi,
I need to convert a comma seperated string, say 34,987 into a number 34987. How do I remove the comma in an apex class?
-
- Aneesha
- June 21, 2013
- Like
- 0
- Continue reading or reply
Calculate future date based on current date + duration
Hi,
I have looked all over the place to find a way to do it. But with no luck!
My requirement is to send an email to the case owner when the case SLA is reaching in 2 days. I have the SLA count which is a number and the case created date. I know I can find the date of SLA by simply adding CreatedDate + SLA, but I also need to exclude the weekends and holidays if possible. I atleast need to remove the weekends.
So suppose a case was created on Wednesday and the SLA is 5 days, then the user should get a mail on Monday, rather than on Saturday. I am planning to implement this through a WF rule with time base trigger but I need the correct date field to send the mail. Please help
Thanks.
-
- Aneesha
- June 13, 2013
- Like
- 0
- Continue reading or reply
How to add lookup filter for a lookup relationship to Opportunities
Hi,
I have a custom obj in which I have lookup relationships to both opportunities and account.
My req is to filter the opps based on the account selected. That is after selecting an account when I click on the opp lookup button I only want the dialog box to show those opps that are related to the selected opp.
I found that we can use lookup filters for implementing this. But however when I try to edit the particular relationship field in the custom object, it does not show a Lookup filter settings section. But this section does show up for lookup fields on account and user. Why is it not showing up here?
-
- Aneesha
- February 27, 2013
- Like
- 0
- Continue reading or reply
Is there way to update a field through after trigger
I know normally it is not possible but I need to run an after trigger and then update a field. Is there a way to do it?
-
- Aneesha
- February 26, 2013
- Like
- 0
- Continue reading or reply
Mystery : User A can view records owned by User B without a sharing rule in place
I have two users A and B with their own diferent role hierarchies( ie, user A comes under Org->CEO->hier-1 and user B comes under Org->CEO->hier-2).
Now i have an account and some opportunities related to that acount. The OWD is private.
I have two sandbox instances. In one of the sandboxes, I can view all the user B owned opportunities related to the account while logged in as user A. Please note that I do not have any sharing rule in place for opportunities object that shares the records between these two users in this sandbox.
In the next sandbox, with the same situation(ie, OWD private and no sharing rules), I cannot see the user B owned opp records related to the same account while logged in as user A.I am confused here. How can user A view opportunity records owned by user B when there is no sharing rule in place? Can someone please explain. Is there anything more than the sharing settings that I should be looking for?
-
- Aneesha
- January 21, 2013
- Like
- 0
- Continue reading or reply
Difference in providing read-only access through page layout and profile
Hi,
I want to provide read-only access to records received through S2S connection to certain users. I have a read-only page layout in place. We can also provide read permission through the profile. What is the difference between these two? Which one subsides the other?For my particular req. which one should I use?
Thanks in advance.
-
- Aneesha
- October 29, 2012
- Like
- 0
- Continue reading or reply
Urgnt: Help required with case views visibility
I have created a view for cases and assigned it to a particular role. What I need is only for the users in that particular role to see that view. But now everyone above this role in the hierarchy is able to view it.
I tried creating a group of users in the role, but the problem persists. Advice me on what to do.
PS: I cannot assign it to specific users as there are a hell lot of them.
-
- Aneesha
- June 21, 2012
- Like
- 0
- Continue reading or reply
Visualforce inserting blank space in place of <li> on apex:dataList
I have a page with some css. There is a <section> tag inside which I am displaying few items from a list using <apex:dataList>. My code works in such a way that when the page loads, one row and four columns of data are displayed on the page. There is a 'View More" link which user can click to load more data. Once I click on this link the result is loaded on some columns with simple blank spaces. There are no null values on the list so I am not sure where this blank is coming from. See below a sample screenshot of the issue.
Below is my code snippet.
<section data-tab='t-recent'> <apex:dataList value="{!displayContentMap}" var="res"> <img src="/{!displayContentMap[res].mainpagearticle.Id}"/> <h3>{!displayContentMap[res].dataCategory} | <apex:outputText value="{!displayContentMap[res].mainPageArticle.Display_Date__c}" /> </h3> <p><a href='/apex/Community_DetailPage?Id={!displayContentMap[res].mainPageArticle.knowledgearticleId}'>{!displayContentMap[res].mainPageArticle.Title}</a></p> </apex:dataList> <apex:outputPanel rendered="{!showViewMore}"> <div class='more'><apex:form ><apex:commandLink action="{!showView}" reRender="resultBlock" >View More</apex:commandLink></apex:form><div class='icn'></div></div> </apex:outputPanel> </section>
-
- Aneesha
- April 08, 2015
- Like
- 1
- Continue reading or reply
Cannot find CollaborationGroupMember object in dataloader
-
- Aneesha
- April 16, 2014
- Like
- 1
- Continue reading or reply
Restricting List View visibility to certain groups
I have certain list views on the custom objects which I want only certain group of people to see. For example I have two list views LV1 and LV2. Certain group of users should only see LV1 and certain others should see only LV2.I have created two public groups and restricted the visibility to 'Certain groups' but still the users are able to see both the list views LV1 and LV2.
Upon investigation I found that the users have system permission 'Manage Public List Views' in their profile.
What can I do to restrict the users from viewing the list views they are not supposed to see?
-
- Aneesha
- August 27, 2013
- Like
- 1
- Continue reading or reply
render a part of the Account page based on the user being part of the Account team
public class AccountTeamChecker { private ApexPages.StandardController sc; public AccountTeamChecker(ApexPages.StandardController sc) { this.sc = sc; } // Returns true if the user is an account team member public Boolean renderELEMENT{ get { if (renderELEMENT== null) { renderELEMENT= [ select count() from AccountTeamMember where AccountId = :sc.getId() and UserId = :UserInfo.getUserId() and AccountAccessLevel in ('Read', 'Edit', 'All') ] > 0; } return renderELEMENT; } private set; } }
VF Page:
<apex:page standardController="Account" extensions="AccountTeamChecker" rendered="!renderELEMENT"> <apex:pageBlock title="Rendering"> RENDERED! </apex:pageBlock> </apex:page>
Do not even get any queries rows on my debug logs. What's not firing? thanks!
- jaw999
- July 22, 2014
- Like
- 0
- Continue reading or reply
Can not file new leads in a "custom list view" list
I have a WordPress website and I am using Gravity Forms with the plugin called "Gravity Forms Salesforce Add-On" (available here: https://wordpress.org/plugins/gravity-forms-salesforce/ ). I have set up the required fields and I am seeing in Salesforce the leads that come from that contact form. The problem is that the leads coming from this contact form are filed directly under the "leads" tab and are not filtered under one of the "leads views" I've created. What am I doing wrong?
Thanks for your help!
- Will Bligh
- July 22, 2014
- Like
- 0
- Continue reading or reply
Give Queue members sequential number on user layout
I need to give sequence number to queue mebers when queue is created on particular object or whenever memeber are added/deleted. I am trying to create assignement based on thoese numbers.
I want the queue related list on user object to show the this number along with queue name.
Please help in this matter. Thank you.
- Surabhi Agrawal
- July 22, 2014
- Like
- 0
- Continue reading or reply
Too many username matches error while deploying dashboards
I am trying to deploy few reports and dashboards to a fullcopy sandbox 'fc' from another fullcopy sandbox via changeset and I am getting the following error message for dashboards.
Too many username matches for abc@gmail.com. The possible matches are abc@gmail.com.fc, abc@gmail.com; edit the username to match only one.
What des this mean?
- Aneesha
- June 06, 2014
- Like
- 0
- Continue reading or reply
need help with the trigger
i have written a trigger on the oppportunity in the object if the stage is "closed won " i need to insert a record in the account.and i m getting the error and the error is (Error:Apex trigger opptrigger caused an unexpected exception, contact your administrator: opptrigger: execution of AfterUpdate caused by: System.DmlException: Upsert failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Required fields are missing: [Account Name]: [Account Name]: Trigger.opptrigger: line 23, column 1)
trigger opptrigger on Opportunity (after insert,after update)
{
//Create a list to hold all new records
List<Account> newRecords = new List<Account>();
//Loop around all records in the trigger transaction
for(Opportunity theRecord : Trigger.new)
{
//Evaluate the record against our critieria
if(theRecord.StageName == 'Closed Won')
{
//The line below creates a new Account record and adds it to our list of new records. Add your field assigments (examples below). Make sure to assign all required fields.
Account newRecord = new Account();
//newRecord.Name = theRecord.name;
//newRecord.Description = 'My New Record';
newRecords.add(newRecord);
}
}
//Insert the new records if any exist
if(newRecords.size() > 0)
upsert newRecords;
}
- santusfdc1.3926196430109492E12
- June 06, 2014
- Like
- 0
- Continue reading or reply
user email update
Any ideas on what can be done?
- Aneesha
- May 11, 2014
- Like
- 0
- Continue reading or reply
rec.Owner.Name returning null in before update trigger
Can somebody help me understand what is the issue?
- Aneesha
- March 11, 2014
- Like
- 0
- Continue reading or reply
S2S Connection Owner cannot insert share records via Apex trigger
Ran into an interesting Salesforce-to-Salesforce (S2S) problem I thought I'd share - it appears the S2S Connection Owner cannot insert share records via Apex trigger.
We have S2S configured in our org to receive Case records from another org. Separately, we have a Case trigger to insert a custom "Performance Rating" object record anytime a Case is closed (to rate the owner). This, in turn, fires a Performance Rating trigger to share the newly inserted record with the Case owner.
It all works fine normally. But when a Case is closed via S2S connection, the Performance Rating trigger is failing with an INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY exception. Apparently, the S2S Connection User isn't being allowed to insert the new Performance_Rating__Share record. The error occurs on the last line in the trigger below:
Trigger shareWithRelatedRecordOwner on Performance_Rating__c (after insert, after update) { List<Performance_Rating__Share> prShareList = new List<Performance_Rating__Share>(); for (Performance_Rating__c pr : Trigger.new) { if(pr.Related_Record_Owner__c != null) { Performance_Rating__Share prShare = new Performance_Rating__Share(); prShare.ParentId = pr.Id; prShare.UserOrGroupId = pr.Related_Record_Owner__c; prShare.AccessLevel = 'read'; prShare.RowCause = Schema.Performance_Rating__Share.RowCause.Related_Record_Owner__c; prShareList.add(prShare); } } insert prShareList; }
Note that "with sharing" isn't coming into play here, so I believe the trigger should be running in system (aka "god") mode, and it really shouldn't matter who the running user is.
My theory is that we're hitting some odd bug related to the S2S Connection User. In my view, this trigger should always work - it shouldn't fail just because it's being invoked as the result of an update made to a record via S2S.
Our quick & dirty workaround was to simply put a try/catch around the insert, and eat the error. But wow, that is an unsatisfying resolution (and it results in the new record NOT being shared with the original Case owner, per the intent of the trigger).
I'd welcome any alternate theories.
- Glenn Weinstein
- November 09, 2013
- Like
- 1
- Continue reading or reply
Rerender a component outside apex:form
I have an apex:pageMessage component outside apex:form which I would like to rerender based on the action of a commandlink and commandbutton inside apex:form. I have placed the pagemessage inside an outputpanel an rerendered the panel using the id, but its not displaying the error message. I can see the error message in the logs. But its not displaying in the page. First of all, i am doing the right thin? Is it even possible to rerender this way?
If not how do i get to rerender the pagemessage component? I cannot put the component inside the form, because currently the form itself is rerendered based on the action of the commandlink and commandbutton.
- Aneesha
- October 23, 2013
- Like
- 0
- Continue reading or reply
Hiding reports from users
Hi,
I have some reports in my org which I only want some users to see. I have created a folder and a public group with those users and shared the folder with the group. It works fine for most of the users.However I found that some users were still able to access this reports. I mean they are not getting the Insufficient privileges error. They can see the report and edit the report. They are not seeing any data on the report.
Why is this happening? My guess is its a profile permission. But I cannot figure out which one.Can somebody please explain?
Thanks in advance.
- Aneesha
- September 06, 2013
- Like
- 0
- Continue reading or reply
Avoid Sharing to users who have no access to the object
His all,
Is there a way to avoid sharing records fro users who dont have access to the object.
in soql even we used with sharing keyword, records are retrieved for the users who have sharing records but not read access in profile
- amilaw
- September 06, 2013
- Like
- 0
- Continue reading or reply
Restricting List View visibility to certain groups
I have certain list views on the custom objects which I want only certain group of people to see. For example I have two list views LV1 and LV2. Certain group of users should only see LV1 and certain others should see only LV2.I have created two public groups and restricted the visibility to 'Certain groups' but still the users are able to see both the list views LV1 and LV2.
Upon investigation I found that the users have system permission 'Manage Public List Views' in their profile.
What can I do to restrict the users from viewing the list views they are not supposed to see?
- Aneesha
- August 27, 2013
- Like
- 1
- Continue reading or reply