-
ChatterFeed
-
0Best Answers
-
1Likes Received
-
0Likes Given
-
6Questions
-
25Replies
Apex trigger to change the contact owner after insert
Hi ,
I am trying to change the contact owner of the contact on insert and I am directed to the page saying insufficient permission.
The profile has a limites access on contact that is only read edit and create. Change the Owner option is available in the UI but unable to control on the edit page
Here is the code
trigger UpdateCOwner on Contact (before insert, after insert) { //Query for the ARS Account Leader of the contact's Account //Set the contact ARS Owner value to Leader value obtained //Insert Record Contact c = new Contact(); Map<String, Contact> contactMap = new Map<String, Contact>(); for (Contact contact : System.Trigger.old) { if(Trigger.isBefore) { if (System.Trigger.isInsert) { string profileName = [select profile.name from user where id = :contact.OwnerId][0].profile.name; if(profileName.indexOf('Call Center')>-1) { Account acnt = [select ARSaccountleader_lookup__c,ACWaccountleader_lookup__c from Account where Id=:contact.AccountId]; string acntLeader = [select ARSaccountleader_lookup__c from Account where Id=:contact.AccountId][0].ARSaccountleader_lookup__c; //string acntLeader = [select ARSaccountleader_lookup__c from Account where Id=:contact.AccountId][0].ARSaccountleader_lookup__c; //string test = acnt.ACWaccountleader_lookup__c; contact.Created_by_Call_Center__c = true; if(acnt.ARSaccountleader_lookup__c != null) { contact.OwnerId = acnt.ARSaccountleader_lookup__c; } else if (acnt.ACWaccountleader_lookup__c != null) { contact.OwnerId = acnt.ACWaccountleader_lookup__c; } contactMap.put(contact.OwnerId,contact); //c = contact; } else contactMap.put(contact.Id,contact); } } } }
Can some one help with finding how this can be handled.A use with limited profile cannot create a contact with the differnt owner and this causing the problem.
Is there a way we can update the record after insert
Thanks in advance.
Thanks & Regards,
Suchitra
Message Edited by Suchitra on 03-07-2008 08:34 AM
-
- Suchitra
- March 07, 2008
- Like
- 1
- Continue reading or reply
List Box with SF custom object field in Outlook Appointment field
Hi All,
I have a requirement to populate a list box in the Outlook Appointment form with the a field in Salesforce custom object. Is this possible ?
Thanks in Advance.
Thanks & Best Regards,
P Suchitra :smileyhappy:
-
- Suchitra
- July 20, 2007
- Like
- 0
- Continue reading or reply
VB.Net Windows Mashup in a S-Control
Hi All,
Can some body please tell me how to mash up a vb.net windows application in a sforce s-control. Please give me some samples to do this.
Thanks & Regards,
P Suchitra :smileyhappy:
-
- Suchitra
- July 11, 2007
- Like
- 0
- Continue reading or reply
API or APP to add phone number from external phone directory to contacts
Hi All,
I would want to know if there is any API or an APP that can be used to check for phone numbers of salesforce contact on external sites like google phone numbers, reverse directory etc and get it inserted in salesforce contact records.
Thanks & Regards
P Suchitra :smileyhappy:
-
- Suchitra
- July 09, 2007
- Like
- 0
- Continue reading or reply
Flex Controls and S-Controls
Hi,
I have a few questions regaring the Adobe Flex tool kit . I would want to learn using this.
Is it possible to create controls in Flex and use them in our S-Control.
I want to see some sample of simple mashups.
Ron if you can help me in this it would be great.
Thanks & Regards
Suchitra :smileyhappy:
I have a few questions regaring the Adobe Flex tool kit . I would want to learn using this.
Is it possible to create controls in Flex and use them in our S-Control.
I want to see some sample of simple mashups.
Ron if you can help me in this it would be great.
Thanks & Regards
Suchitra :smileyhappy:
-
- Suchitra
- June 30, 2007
- Like
- 0
- Continue reading or reply
Distinct in soql
Hi,
I would like to know is there any ways to get distinct records in soql
I want to extract the product family using a query I get all the records having family but I want only distinct records how do I do that ?
Thanks in advance
Suchitra
-
- Suchitra
- June 05, 2007
- Like
- 0
- Continue reading or reply
Apex trigger to change the contact owner after insert
Hi ,
I am trying to change the contact owner of the contact on insert and I am directed to the page saying insufficient permission.
The profile has a limites access on contact that is only read edit and create. Change the Owner option is available in the UI but unable to control on the edit page
Here is the code
trigger UpdateCOwner on Contact (before insert, after insert) { //Query for the ARS Account Leader of the contact's Account //Set the contact ARS Owner value to Leader value obtained //Insert Record Contact c = new Contact(); Map<String, Contact> contactMap = new Map<String, Contact>(); for (Contact contact : System.Trigger.old) { if(Trigger.isBefore) { if (System.Trigger.isInsert) { string profileName = [select profile.name from user where id = :contact.OwnerId][0].profile.name; if(profileName.indexOf('Call Center')>-1) { Account acnt = [select ARSaccountleader_lookup__c,ACWaccountleader_lookup__c from Account where Id=:contact.AccountId]; string acntLeader = [select ARSaccountleader_lookup__c from Account where Id=:contact.AccountId][0].ARSaccountleader_lookup__c; //string acntLeader = [select ARSaccountleader_lookup__c from Account where Id=:contact.AccountId][0].ARSaccountleader_lookup__c; //string test = acnt.ACWaccountleader_lookup__c; contact.Created_by_Call_Center__c = true; if(acnt.ARSaccountleader_lookup__c != null) { contact.OwnerId = acnt.ARSaccountleader_lookup__c; } else if (acnt.ACWaccountleader_lookup__c != null) { contact.OwnerId = acnt.ACWaccountleader_lookup__c; } contactMap.put(contact.OwnerId,contact); //c = contact; } else contactMap.put(contact.Id,contact); } } } }
Can some one help with finding how this can be handled.A use with limited profile cannot create a contact with the differnt owner and this causing the problem.
Is there a way we can update the record after insert
Thanks in advance.
Thanks & Regards,
Suchitra
Message Edited by Suchitra on 03-07-2008 08:34 AM
-
- Suchitra
- March 07, 2008
- Like
- 1
- Continue reading or reply
Apex trigger to change the contact owner after insert
Hi ,
I am trying to change the contact owner of the contact on insert and I am directed to the page saying insufficient permission.
The profile has a limites access on contact that is only read edit and create. Change the Owner option is available in the UI but unable to control on the edit page
Here is the code
trigger UpdateCOwner on Contact (before insert, after insert) { //Query for the ARS Account Leader of the contact's Account //Set the contact ARS Owner value to Leader value obtained //Insert Record Contact c = new Contact(); Map<String, Contact> contactMap = new Map<String, Contact>(); for (Contact contact : System.Trigger.old) { if(Trigger.isBefore) { if (System.Trigger.isInsert) { string profileName = [select profile.name from user where id = :contact.OwnerId][0].profile.name; if(profileName.indexOf('Call Center')>-1) { Account acnt = [select ARSaccountleader_lookup__c,ACWaccountleader_lookup__c from Account where Id=:contact.AccountId]; string acntLeader = [select ARSaccountleader_lookup__c from Account where Id=:contact.AccountId][0].ARSaccountleader_lookup__c; //string acntLeader = [select ARSaccountleader_lookup__c from Account where Id=:contact.AccountId][0].ARSaccountleader_lookup__c; //string test = acnt.ACWaccountleader_lookup__c; contact.Created_by_Call_Center__c = true; if(acnt.ARSaccountleader_lookup__c != null) { contact.OwnerId = acnt.ARSaccountleader_lookup__c; } else if (acnt.ACWaccountleader_lookup__c != null) { contact.OwnerId = acnt.ACWaccountleader_lookup__c; } contactMap.put(contact.OwnerId,contact); //c = contact; } else contactMap.put(contact.Id,contact); } } } }
Can some one help with finding how this can be handled.A use with limited profile cannot create a contact with the differnt owner and this causing the problem.
Is there a way we can update the record after insert
Thanks in advance.
Thanks & Regards,
Suchitra
Message Edited by Suchitra on 03-07-2008 08:34 AM
- Suchitra
- March 07, 2008
- Like
- 1
- Continue reading or reply
Seeking salesforce.com administrator in Sunnyvale, CA
We are looking for a full-time Salesforce.com Administrator located in Sunnyvale, CA.
This person will enhance and maintain our existing Salesforce.com Application, which includes day-to-day management and customization.
Must have a good understanding of accounts, opportunities, opportunities, opportunity line items, pricebooks, products. We have created standalone applications that automatically load opportunities based on customer quotes with a nice VB.net application. Understanding of (and experience using)VB.net is a definite plus.
We are integrating our Great Plains ERP system to Salesforce.com using Scribe. Knowledge of Scribe is also a plus.
Please reply to this post for further information.
No consultancy replies please, this is for a permanent job position.
- jmarinchak
- July 14, 2007
- Like
- 0
- Continue reading or reply
API or APP to add phone number from external phone directory to contacts
Hi All,
I would want to know if there is any API or an APP that can be used to check for phone numbers of salesforce contact on external sites like google phone numbers, reverse directory etc and get it inserted in salesforce contact records.
Thanks & Regards
P Suchitra :smileyhappy:
- Suchitra
- July 09, 2007
- Like
- 0
- Continue reading or reply
Update Custom Object using API from external web application
Hello,
I have created a new custom Object called "Projects". I would like to update/create/insert new records from a seperate web application to Projects object in SalesForce.
This scenario is similar to "Web - to-lead" case. .
Typically I will have a webpage(form) hosted in a our website and the users will fill the form and submit it.
Then I should be able to capture the data from the form and update it into the Project object(table) in Salesforce and should be able to also view the user input data in sales force appication
I do not know if it is possible as I have created a custom object and not using the existing object "lead"
Your help is highly appreciated.
Thanks....
- meenaSF
- July 03, 2007
- Like
- 0
- Continue reading or reply
Flex Controls and S-Controls
Hi,
I have a few questions regaring the Adobe Flex tool kit . I would want to learn using this.
Is it possible to create controls in Flex and use them in our S-Control.
I want to see some sample of simple mashups.
Ron if you can help me in this it would be great.
Thanks & Regards
Suchitra :smileyhappy:
I have a few questions regaring the Adobe Flex tool kit . I would want to learn using this.
Is it possible to create controls in Flex and use them in our S-Control.
I want to see some sample of simple mashups.
Ron if you can help me in this it would be great.
Thanks & Regards
Suchitra :smileyhappy:
- Suchitra
- June 30, 2007
- Like
- 0
- Continue reading or reply
S-Control to Sum Amounts from Opportunities
Hello,
I am trying to sum the amounts from a group of Opportunities. But I get a NaN (Not a Number) returned when trying to total up the amounts. See code below. I have tried to parse to a float, number, etc. but with no luck. What am I missing?
Thanks!
<html>
<head>
<script src="/soap/ajax/9.0/connection.js"></script>
<script src="/js/dojo/0.4.1/dojo.js"></script>
<script>
dojo.addOnLoad(init);
function init() {
var callback = {
onSuccess : displayResult,
onFailure : displayError
};
sforce.connection.query("SELECT Amount FROM Opportunity WHERE CloseDate = THIS_YEAR AND IsWon = true AND Probability = 100", callback);
}
function displayResult(result) {
var it = new sforce.QueryResultIterator(result);
var html = [];
var totalAmount;
while(it.hasNext()) {
var record = it.next();
totalAmount += parseFloat(record.Amount);
html.push("Amount = " + record.Amount + "<br>");
html.push("<hr>");
html.push("<br>");
}
alert(totalAmount);
document.getElementById("output-div").innerHTML = html.join("");
}
function displayError(error) {
document.getElementById("output-div").innerHTML =
"oops something went wrong ... " + error;
}
</script>
</head>
<body>
<div id="output-div"></div>
</body>
</html>
I am trying to sum the amounts from a group of Opportunities. But I get a NaN (Not a Number) returned when trying to total up the amounts. See code below. I have tried to parse to a float, number, etc. but with no luck. What am I missing?
Thanks!
<html>
<head>
<script src="/soap/ajax/9.0/connection.js"></script>
<script src="/js/dojo/0.4.1/dojo.js"></script>
<script>
dojo.addOnLoad(init);
function init() {
var callback = {
onSuccess : displayResult,
onFailure : displayError
};
sforce.connection.query("SELECT Amount FROM Opportunity WHERE CloseDate = THIS_YEAR AND IsWon = true AND Probability = 100", callback);
}
function displayResult(result) {
var it = new sforce.QueryResultIterator(result);
var html = [];
var totalAmount;
while(it.hasNext()) {
var record = it.next();
totalAmount += parseFloat(record.Amount);
html.push("Amount = " + record.Amount + "<br>");
html.push("<hr>");
html.push("<br>");
}
alert(totalAmount);
document.getElementById("output-div").innerHTML = html.join("");
}
function displayError(error) {
document.getElementById("output-div").innerHTML =
"oops something went wrong ... " + error;
}
</script>
</head>
<body>
<div id="output-div"></div>
</body>
</html>
- scottskiblack
- June 28, 2007
- Like
- 0
- Continue reading or reply
filter on relationship query
Hi,
I use enterprise wsdl version 9.
select count() FROM OpportunityLineItem oli WHERE oli.PricebookEntry.Product2.Fileds1__c <> 0
and compare to
select count() FROM OpportunityLineItem oli
I get the same results, although in data, their are some data Product2.Fileds1__c = 0
So, filtering on above seems not working, anyone get this issue and how to fix it? Thanks
sq
I use enterprise wsdl version 9.
select count() FROM OpportunityLineItem oli WHERE oli.PricebookEntry.Product2.Fileds1__c <> 0
and compare to
select count() FROM OpportunityLineItem oli
I get the same results, although in data, their are some data Product2.Fileds1__c = 0
So, filtering on above seems not working, anyone get this issue and how to fix it? Thanks
sq
- SimplySfdc
- June 27, 2007
- Like
- 0
- Continue reading or reply
Querying 2 Objects in 1 S-Control
Could anyone please kindly advise what is wrong with my coding below? I am querying one type of data in each of 2 objects in one S-Control using the Select/From/Where Statements. I could get the output correctly for each type of data for each object but when it shows on the output it only shows one object's data in both output.Any pointer will be highly appreciated
Thanks in advance - SL
This is my code used
<html>
<head>
<script src="/soap/ajax/9.0/connection.js"></script>
<script src="/js/dojo/0.4.1/dojo.js"></script>
<head>
<script src="/soap/ajax/9.0/connection.js"></script>
<script src="/js/dojo/0.4.1/dojo.js"></script>
<script>
dojo.addOnLoad(init);
dojo.addOnLoad(init);
function init() {
var callback = { onSuccess : displayResult,
onFailure : displayError
};
sforce.connection.query("SELECT Id, Name FROM New_Type__c WHERE Id = '{!Customer_Order__c.New_TypeId__c}' " , callback );
sforce.connection.query("SELECT Id, Name FROM Final_Buyer__c WHERE Id = '{!Customer_Order__c.Final_BuyerId__c}' " , callback );
}
function displayResult(result) {
var it = new sforce.QueryResultIterator(result);
var html = [];
while(it.hasNext()) {
var record = it.next();
var callback = { onSuccess : displayResult,
onFailure : displayError
};
sforce.connection.query("SELECT Id, Name FROM New_Type__c WHERE Id = '{!Customer_Order__c.New_TypeId__c}' " , callback );
sforce.connection.query("SELECT Id, Name FROM Final_Buyer__c WHERE Id = '{!Customer_Order__c.Final_BuyerId__c}' " , callback );
}
function displayResult(result) {
var it = new sforce.QueryResultIterator(result);
var html = [];
while(it.hasNext()) {
var record = it.next();
html.push( "<b>New Type: </b><br> " + record.Name + " <br><br>");
html.push( "<b>Final Buyer: </b><br> " + record.Name + " <br>");
html.push("<hr>");
html.push("<br>");
html.push( "<b>Final Buyer: </b><br> " + record.Name + " <br>");
html.push("<hr>");
html.push("<br>");
}
document.getElementById("output-div").innerHTML = html.join("");
}
}
function displayError(error) {
document.getElementById("output-div").innerHTML =
"oops something went wrong ... " + error;
}
</script>
document.getElementById("output-div").innerHTML =
"oops something went wrong ... " + error;
}
</script>
</head>
<body>
<div id="output-div"></div>
</body>
</html>
</html>
- SL Tan
- June 22, 2007
- Like
- 0
- Continue reading or reply
How to create field dependency between picklist and number/text field?
I have a picklist having values A and B (this field is sforce field. Not an scontrol field.)
While selecting value "A" I need to display a field(will be number or text field).
And while selecting value "B" I need to hide that field.
Any way to do it?
Thanks
- anju
- June 21, 2007
- Like
- 0
- Continue reading or reply