• Team Works
  • NEWBIE
  • 160 Points
  • Member since 2013
  • Salesforce Technical Analyst/Developer
  • Cloud9Force Ltd, UK

  • Chatter
    Feed
  • 3
    Best Answers
  • 2
    Likes Received
  • 0
    Likes Given
  • 31
    Questions
  • 99
    Replies
Hi,

Need to write a trigger such that if a Contact already exists ( based on email, phone or name) on the Parent Account or any of the Parents' Child accounts, then if a user tries to Create a Contact, an error should be thrown.

This trigger should be Account based and not Org. 


Lets say a Contact is created on Account 'B'. Account 'A' is the parent for account B. and if i try to create same contact on Account 'C' ( another Child of Account 'A'), error should be thrown.

or also if the Contact exists on Parent and if we try to create  a duplicate on any of its Child, even then an error should be thrown.

I had written a trigger but that worked only on a single account.

Thank You.
Hello Guys

Again Stuck with the concatenation :

private final String SOQL_RECENT_REC = 'SELECT LastViewedDate,Type,UserRoleId FROM RecentlyViewed';
private final String CONDITION_USER_SORT = ' Order By LastViewedDate DESC LIMIT 20';
List<RecentlyViewed> recentViewed= new List<RecentlyViewed>();
recentViewed = Database.query(SOQL_RECENT_REC +' WHERE Type = \'Account \' ' + CONDITION_USER_SORT);

Should run a query like the following :
recentViewed = [SELECT LastViewedDate,Type,UserRoleId FROM RecentlyViewed Where Type='Account' Order By LastViewedDate DESC LIMIT 20];

Many Thanks !!
Hello Dear All,

I hope you having a good day but i am kind of stuck.

I am currently displaying the User List in a custom VF Page. When i click the Name of the User it should take the user to a Custom Visualforce page where i will display the some user details, and list of his Activities, Accounts, Opportunities. Shall i use the standard User Controller and OR a custom controller. Please Guide me the steps.

Many Thanks

I want to concatenate two strings to for the query to be executed using Database.Query. Here is what i am doing
string sql1 = 'Select Custom_Name__c from Opportunity  where AccountId IN';
string2 sql2= '(Select Id from Account where Europe__c =True)';
Opp=Database.query(sql1+sql2);
sysem.debug(Opp);
Doesn't work.Any Ideas?
Hello All,

I need to create a Home Page component with a Tab 'Interested In'. In this tab i need to display the Accounts i am following(irrespective of I own it or not.)  I am the logged in User..

Please guide/suggest

Many Thanks
Hello friends,

I need to create a visual force page where i need to display me and people who report to logged in User(me)....ofcourse based on the role hierarchy setup in my Org.

Kindly guide me to link explaining such an example or how can i approach this?

Many Thanks

Hello All,
Has anyone used the WADL file into salesforce. I have got WADL file from another Application Team. When i import this sfile into Salesforce it errors out.
Just looking for a way to consume WADL in salesforce if anyone can help?
Hi All

Just trying to Use Custom Setting in a Formula field. I have too many custom formula field on the account Object and hit the limit of max 15. Would like to know how can i use Heirarchical Custom setting in Cross Object Formuls..Many Thanks in advance 
Hello All,

How can i invoke apex code from a button, where using the apex i should be able to aggregate the fields from the child records.?

Please suggest

Thanks!

Can anyone please suggest what  file has to be imported in IMPORT WADL ?

I thought I'd share since figuring this out was kind of crappy.  Since you can't (or I couldn't find how) concatenate a string in an SOQL query to combine wildcards like % and _ to make a query, you need to do so with the variable you want to pass in.

 

So if you want to do an SOQL query using LIKE, wild cards, and an Apex variable, this will work.

 

//create a string
String s = 'mystring';

//add wildcards around it to be more flexible in the search
s = '%' + s + '%';

//create an SOBject list with the results from our query
SObject[] obj = [select id from SObjectName where Name LIKE :s];

 

and this will return any row from the SObjectName where the "Name" field has "mystring" in it.