• vutukuru balaji
  • NEWBIE
  • 10 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 4
    Questions
  • 2
    Replies
hi I write a trigger which blocks insertion of duplicate records in account object.but i want for particular user to the trigger should not be fired.i know that we restrict it by using hierchy custom setting but how to do these please can any explain about it.
My trigger code is:

trigger duplicaterecord on Account (before insert) {

 set<string>names=new set<string>();
    List<Account>accs=[select id,name from account];
    for(Account a:accs)
    {
        names.add(a.name);
    }
    for(account b:trigger.new)
    {
        if(names.contains(b.name))
        {
            b.addError('Duplicate Record');
        }
    }
}
hi i have a task when we deactivating a user,the ownership of all the records owned by this user has to changed to his manager by using trigger.can any body please help for the code that need to be write for the trigger
hi i am implemented a visual force page which displays account object records by reading either name or type or industry of account object record.by selecting the checkbox in headerbar i have to select all the records checkboxes which have been displayed by retriving.and then delete them by clicking delete button .how to implement this functionality of selecting all and deleting.
my Vf page code is:
<apex:page controller="searchquery">
<apex:form >
<apex:pageBlock >
<apex:pageBlockSection columns="1">
<apex:pageBlockSectionItem >
<apex:outputLabel value="Enter Name"/>
<apex:inputText value="{!aname}"/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel value="Enter industry"/>
<apex:inputText value="{!aindustry}"/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel value="Enter type"/>
<apex:inputText value="{!atype}"/>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
<apex:pageBlockButtons location="bottom">
<apex:commandButton value="submit" action="{!search}" reRender="one"/>
</apex:pageBlockButtons>
</apex:pageBlock>
<apex:pageBlock id="one">
<apex:pageBlockTable value="{!result}" var="a">
<apex:column >
<apex:facet name="header">
<apex:inputcheckbox label="select"/>
</apex:facet>
<apex:inputCheckbox />
</apex:column>
<apex:column value="{!a.name}"/>
<apex:column value="{!a.industry}"/>
<apex:column value="{!a.type}"/>
<apex:column value="{!a.AccountNumber}"/>
<apex:column value="{!a.AnnualRevenue}"/>
<apex:column value="{!a.Phone}"/>
</apex:pageBlockTable>
<apex:pageblockbuttons location="bottom">
<apex:commandButton value="delete"/>
</apex:pageblockbuttons>
</apex:pageBlock>
</apex:form>
</apex:page>
and my apex class is
public class searchquery
{
public list<Account> result{set;get;}
public string aname{set;get;}
public string aType{set;get;}
public string aindustry{set;get;}
public string rpl{set;get;}
public boolean flag{set;get;}
public searchquery()
{
result=new list<Account>();
selected=false;
}
public void search()
{
rpl='select name,industry,type,AccountNumber,phone,AnnualRevenue from account';
if((aname!=''&&aname!=null)&&(atype!=''&&atype!=null)&&(aindustry!=''&&aindustry!=null))
{
rpl=rpl+' where (industry=:aindustry AND type=:atype AND name=:aname)';
}
else
{
if((aname!=''&&aname!=null)&&(atype!=''&&atype!=null))
{
rpl=rpl+' where (type=:atype AND name=:aname)';
}
else
{
if((atype!=''&&atype!=null)&&(aindustry!=''&&aindustry!=null))
{
rpl=rpl+' where (industry=:aindustry AND type=:atype)';
}
else
{
if((aname!=''&&aname!=null)&&(aindustry!=''&&aindustry!=null))
{
rpl=rpl+' where (industry=:aindustry AND name=:aname)';
}
else
{
if(aname!=''&&aname!=null)
{
rpl=rpl+' where (name=:aname)';
}
else
{
if(atype!=''&&atype!=null)
{
rpl=rpl+' where (type=:atype)';
}
else
{
if(aindustry!=''&&aindustry!=null)
{
rpl=rpl+' where (industry=:aindustry)';
}
}
}
}
}
}
}
result=Database.query(rpl);
}
}
 
Public Class Example
{
public static Integer a;
public integer b;
public Example()
{
a=10;
b=10;
}
public void add()
{
a=a+10;
b=b+10;
System.debug('a value is '+a);
System.debug('b value is '+b);
}
}


in the anonymous class

Example e1= new Example();
e1.add();
Example e2= new Example();
e2.add();


what is use of static keyword???????????
 
hi I write a trigger which blocks insertion of duplicate records in account object.but i want for particular user to the trigger should not be fired.i know that we restrict it by using hierchy custom setting but how to do these please can any explain about it.
My trigger code is:

trigger duplicaterecord on Account (before insert) {

 set<string>names=new set<string>();
    List<Account>accs=[select id,name from account];
    for(Account a:accs)
    {
        names.add(a.name);
    }
    for(account b:trigger.new)
    {
        if(names.contains(b.name))
        {
            b.addError('Duplicate Record');
        }
    }
}
hi i have a task when we deactivating a user,the ownership of all the records owned by this user has to changed to his manager by using trigger.can any body please help for the code that need to be write for the trigger
Hi all, 
I'm a newby in Salesforce so I decided to start learning with the Trailhead. 
I have completed all the challanghes related to the "Getting Started with the Force.com Platform". 
This morning I started with the part 2: "Intro to Visual App Development". 

The fist challenge for Workflow Atuomation is about "Automated Process with Workflow". 
I did the challenge but I receive a failure even if It should seems to run correctly in my Develper Edition Platform. 
Tha error massage received by the check challange button is "Challenge not yet complete... here's what's wrong: Case escalation failed to assign a task to the owner."

I say that all seems to work fine because I edited e case, set up the Priority to High and: 
1) The Escaleted flag was set automatically to true as per the rule action defined
2) I receive a notification about escalation on that case (because I'm the owner of the case as per the task definition field)
3) An activity under the case was automatically created and assigne to me. 

As anyone tha same problem?
Any help would be much appreciated. 
Thank's in advance,
Alvaro.