• ANITHA BEEMU 2
  • NEWBIE
  • 40 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 17
    Questions
  • 29
    Replies
is there any way to know when the report is opened and how many types those are seeing in salesforce
HI i am having a users who is in high hierachy  having modify all and delete access on opportunity and documents and OWD for opportunities is REad/write,BUt user is not able to delete files on opportunity of his lower level users record.can anyone pls help
i need a formula on process builder,with critriea opportunity stage closed won,Referral (custom field) not null and contract term <3 years

i have conterm term a picklist field with values 12,24,36,48,60,72 all in months

for <3 years one formula
for  3 years one formula and 
for 4+ years one formula

i tired following one,getting error:
AND( 
OR( 
ISPICKVAL([Opportunity].StageName , "Closed Won"), 
OR( 
 NOT ( ISBLANK ( [Opportunity].Referral__c )  ), 
OR( 
ISPICKVAL([Opportunity].ContractTerm__c <36 )) ) 
)
)


please help me in this
 
i need a formula on process builder,with critriea opportunity stage closed won,Referral (custom field) not null and contract term <3 years

i have conterm term a picklist field with values 12,24,36,48,60,72 all in months

for <3 years one formula
for  3 years one formula and 
for 4+ years one formula

i tired following one,getting error:
AND( 
OR( 
ISPICKVAL([Opportunity].StageName , "Closed Won"), 
OR( 
 NOT ( ISBLANK ( [Opportunity].Referral__c )  ), 
OR( 
ISPICKVAL([Opportunity].ContractTerm__c <36 )) ) 
)
)


please help me in this

 
HI all,
i have custom object called locations which is master detail relationship with opportunities,now i want a button (existing location)on the related list of locations in the opportunitypage.i tired below code:

apex code:
public with sharing class ExiLocExtController {

 

    public Opportunity opportunity  { get; set; }

     

    public ExiLocExtController() {

         

        String OpportunityId = ApexPages.currentPage().getParameters().get('id');

        Opportunity = [SELECT Id, Name, Location__c FROM Opportunity WHERE Id =: OpportunityId];

         

    }

     

    public PageReference save () {

         

        Location__c LOC = new Location__c ( Id = Opportunity.Location__c, Opportunity_Name__c = Opportunity.Id);

         

        try {

            Database.update(LOC);

        } catch (Exception error) {

            ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, 'Error while associating.' + error.getMessage()));
       }

         

        PageReference page = new PageReference('/' + Opportunity.Id);

         

        return page.setRedirect(true);

    }

     

    public PageReference cancel () {

        PageReference page = new PageReference('/' + Opportunity.Id);

        return page.setRedirect(true);        

    }


}
visual page:

<apex:page controller="ExiLocExtController">
 <apex:form >

        <apex:pageblock title="ExistingLocationto test">

            <apex:pageMessages />

            <apex:pageblockbuttons location="top">

                <apex:commandbutton value="save" action="{!save}" />

                <apex:commandbutton value="Cancel" action="{!cancel}"/>

            </apex:pageblockbuttons>

            <apex:pageBlockSection >

                <apex:pageBlockSectionItem >

                    <apex:outputLabel >Opportunity Name</apex:outputLabel>

                    <apex:outputText >{!Opportunity.Name}</apex:outputText>  

                </apex:pageBlockSectionItem>

              <apex:pageBlockSectionItem >

                    <apex:outputLabel >Location__c</apex:outputLabel>

                    <apex:inputField value="{!Opportunity.Location__c}"/>

                </apex:pageBlockSectionItem>               

            </apex:pageBlockSection>

        </apex:pageblock>

    </apex:form>

</apex:page>

i am able to open the page,but that is not saving to the opportunity,kindly help me.
 
HI all,
i have custom object called locations which is master detail relationship with opportunities,now i want a button (existing location)on the related list of locations in the opportunitypage.i tired 

1-) Create a custom related list button in Opportunity as shown below:




2-) Add the url below to your button:

/apex/AssociateOpportunity?id={!Account.Id}

3-) Add the button to the Opportunity's related list in Account's page layout:





4-) Create a custom lookup field for Opportunity in Account (this is a trick to get the lookup field of Opportunity working in the Visualforce). This button won't be visible and will not be added to any layouts and won't include any related list.




5-) Create a controller class (I named it AssociateOpportunityExtController): 
 
01public with sharing class AssociateOpportunityExtController {
02 
03    public Account account  { get; set; }
04     
05    public AssociateOpportunityExtController() {
06         
07        String accountId = ApexPages.currentPage().getParameters().get('id');
08        account = [SELECT Id, Name, Opportunity__c FROM Account WHERE Id =: accountId];
09         
10    }
11     
12    public PageReference associate () {
13         
14        Opportunity opp = new Opportunity ( Id = account.Opportunity__c, AccountId = account.Id);
15         
16        try {
17            Database.update(opp);
18        } catch (Exception error) {
19            ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, 'Error while associating.' + error.getMessage()));
20        }
21         
22        PageReference page = new PageReference('/' + account.Id);
23         
24        return page.setRedirect(true);
25    }
26     
27    public PageReference cancel () {
28        PageReference page = new PageReference('/' + account.Id);
29        return page.setRedirect(true);       
30    }
31     
32}
6-) Create a Visualforce (I named it AssociateOpportunity):
 
01<apex:page controller="AssociateOpportunityExtController">
02    <apex:form>
03        <apex:pageblock title="Associate Opportunity to Custom Object">
04            <apex:pageMessages />
05            <apex:pageblockbuttons location="top">
06                <apex:commandbutton value="Associate" action="{!associate}" />
07                <apex:commandbutton value="Cancel" action="{!cancel}"/>
08            </apex:pageblockbuttons>
09            <apex:pageBlockSection>
10                <apex:pageBlockSectionItem>
11                    <apex:outputLabel>Account Name</apex:outputLabel>
12                    <apex:outputText>{!account.Name}</apex:outputText>  
13                </apex:pageBlockSectionItem>
14              <apex:pageBlockSectionItem>
15                    <apex:outputLabel>Opportunity</apex:outputLabel>
16                    <apex:inputField value="{!account.Opportunity__c}"/>
17                </apex:pageBlockSectionItem>               
18            </apex:pageBlockSection>
19        </apex:pageblock>
20    </apex:form>
21</apex:page>

(i changed objectnames as in above its for different object) after following this getting error "Namespace length cannot exceed 15 chars "..
can any one help pls.
I tired following code :

Trigger CopyopportunityAttachtoAccount on Attachment (after insert)     
{
    set<id> Oppids=new set<id>();
    Map<id, attachment> OpportunityAttachments = new Map<id, attachment>();
    Map<id, Opportunity> OpportunitiesWithAccount = new Map<id, Opportunity>();
    for(attachment an:trigger.new)
    {
        if(an.ParentId.getSobjectType() == Opportunity.SobjectType) OpportunityAttachments.put(an.ParentId, an);
            //Oppids.add(an.ParentId);
    }
    // not required, as using soql 
    // list<Opportunity> OppAccmap =new list<Opportunity>([Select Account.id,Account.name from Opportunity where Id In:Oppids]);

    list<attachment> accatt=new list<attachment>();
    //for(Opportunity Ot:OppAccmap){
    // read "Explanation" why I have replaced Soql For loop with your approach
    if (OpportunityAttachments.keySet().size() > 0) // Read "Explanation" why this check is introduced.
    {
        OpportunitiesWithAccount = new Map<Id, Opportunity>([SELECT Id, Account.id FROM Opportunity WHERE Id IN :OpportunityAttachments.keySet()]);
        // for (attachment am :[select id, name,parentId, body from Attachment where ParentId in :Oppids]) // soql inside for loop is bad, bad thing.
        for (attachment am: OpportunityAttachments.values() ) 
        {
            if (OpportunitiesWithAccount.containsKey(am.ParentId) )
            {
                Attachment newFile = New Attachment(Name = am.name, body = am.body, ParentId=OpportunitiesWithAccount(am.ParentId);
                accatt.add(newFile);
            }
        }
    }
    insert accatt;
}

GETTING ERROE OVER HERE:

Attachment newFile = New Attachment(Name = am.name, body = am.body, ParentId=OpportunitiesWithAccount(am.ParentId);
                accatt.add(newFile);

AND Incorrect SObject type ..PLS DO HELP
<apex:page controller="ExistingLocationExtController">
 <apex:form >

        <apex:pageblock title="ExistingLocation">

            <apex:pageMessages />

            <apex:pageblockbuttons location="top">

                <apex:commandbutton value="Associate" action="{!associate}" />

                <apex:commandbutton value="Cancel" action="{!cancel}"/>

            </apex:pageblockbuttons>

            <apex:pageBlockSection >

                <apex:pageBlockSectionItem >

                    <apex:outputLabel >Opportunity Name</apex:outputLabel>

                    <apex:outputText >{!Opportunity.Name}</apex:outputText>  

                </apex:pageBlockSectionItem>

              <apex:pageBlockSectionItem >

                    <apex:outputLabel >Location__c</apex:outputLabel>

                    <apex:inputField value="{!Opportunity.Location__c}"/>

                </apex:pageBlockSectionItem>               

            </apex:pageBlockSection>

        </apex:pageblock>

    </apex:form>

</apex:page>

while opening the button,got the following error:

Error: Namespace length cannot exceed 15 chars..i read some where and used

<EZSign:Clear_Signature__c /> but still geting another error:

Error: existing_locations line 3, column 2: The content of elements must consist of well-formed character data or markup​.

can anyone pls help..
.i am having custom object,in which i have fields like state,city,street adress ,zip,with these information i want a map in the same object record..is this possible..

i tried this https://eshopsync.com/integrate-google-map-api-salesforce-2/   (https://eshopsync.com/integrate-google-map-api-salesforce-2/  )
below is my code:
<apex:page standardController="Location__c">
<head>
<script type="text/javascript" src="https://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
var myOptions={ zoom: 15,mapTypeId: google.maps.MapTypeId.ROADMAP,mapTypeControl: false };
var map;
var marker;
var geocoder = new google.maps.Geocoder();
var address ="{!Location__c.Street_Address__c},{!Location__c.Zip__c}{!Location__c.City__c}, {!Location__c.State__c},{!Location__c.Country__c}";
var infowindow = new google.maps.InfoWindow({
content: "<b>{!Location__c}</b><br>{!Location__c.Street_Address__c}<br>{!Location__c.City__c}, {!Location__c.Zip__c}<br>{!Location__c.State__c}<br>{!Location__c.Country__c}"
});
 
geocoder.geocode( { address: address}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK&&results.length) {
if (status != google.maps.GeocoderStatus.ZERO_RESULTS) {
 
//create map
map = new google.maps.Map(document.getElementById("map"), myOptions);
 
//center map
map.setCenter(results[0].geometry.location);
 
//create marker
marker = new google.maps.Marker({
position: results[0].geometry.location,
map: map,
title: "{!Location__c.Name}"
});
 
//add listeners
google.maps.event.addListener(marker, 'click', function() {
infowindow.open(map,marker);
});
google.maps.event.addListener(infowindow, 'closeclick', function() {
map.setCenter(marker.getPosition());
});
}
} else {
$('#map').css({'height' : '15px'});
$('#map').html("Oops! {!Location__c.Name}'s billing address could not be found, please make sure the address is correct.");
resizeIframe();
}
});
 
function resizeIframe() {
var me = window.name;
if (me) {
var iframes = parent.document.getElementsByName(me);
if (iframes&&iframes.length == 1) {
height = document.body.offsetHeight;
iframes[0].style.height = height + "px";
}
}
}
});
</script>
<style>
#map {
font-family: Arial;
font-size:12px;
line-height:normal !important;
height:250px;
background:transparent;
}
</style>
</head>
<body>
<div id="map"></div>
</body>
</apex:page>

its working but getting this pop up window..can anyone help to avoid that one..
i tried this https://eshopsync.com/integrate-google-map-api-salesforce-2/   (https://eshopsync.com/integrate-google-map-api-salesforce-2/  )
below is my code:
<apex:page standardController="Location__c">
<head>
<script type="text/javascript" src="https://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
var myOptions={ zoom: 15,mapTypeId: google.maps.MapTypeId.ROADMAP,mapTypeControl: false };
var map;
var marker;
var geocoder = new google.maps.Geocoder();
var address ="{!Location__c.Street_Address__c},{!Location__c.Zip__c}{!Location__c.City__c}, {!Location__c.State__c},{!Location__c.Country__c}";
var infowindow = new google.maps.InfoWindow({
content: "<b>{!Location__c}</b><br>{!Location__c.Street_Address__c}<br>{!Location__c.City__c}, {!Location__c.Zip__c}<br>{!Location__c.State__c}<br>{!Location__c.Country__c}"
});
 
geocoder.geocode( { address: address}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK&&results.length) {
if (status != google.maps.GeocoderStatus.ZERO_RESULTS) {
 
//create map
map = new google.maps.Map(document.getElementById("map"), myOptions);
 
//center map
map.setCenter(results[0].geometry.location);
 
//create marker
marker = new google.maps.Marker({
position: results[0].geometry.location,
map: map,
title: "{!Location__c.Name}"
});
 
//add listeners
google.maps.event.addListener(marker, 'click', function() {
infowindow.open(map,marker);
});
google.maps.event.addListener(infowindow, 'closeclick', function() {
map.setCenter(marker.getPosition());
});
}
} else {
$('#map').css({'height' : '15px'});
$('#map').html("Oops! {!Location__c.Name}'s billing address could not be found, please make sure the address is correct.");
resizeIframe();
}
});
 
function resizeIframe() {
var me = window.name;
if (me) {
var iframes = parent.document.getElementsByName(me);
if (iframes&&iframes.length == 1) {
height = document.body.offsetHeight;
iframes[0].style.height = height + "px";
}
}
}
});
</script>
<style>
#map {
font-family: Arial;
font-size:12px;
line-height:normal !important;
height:250px;
background:transparent;
}
</style>
</head>
<body>
<div id="map"></div>
</body>
</apex:page>

its working but getting this pop up window..can anyone help to avoid that one..User-added image

trigger TriggerTo_Delete_AccountLookup on Account (before delete) {

     

    //To store parent ids

    list<id> AccountIds=new list<id>();

    for(Account accountVar:trigger.old)

    {

        AccountIds.add(accountVar.id);

    } 

    //Collecting all child records related to Parent records

    list<AccountLookup__c> listOfAccountLookup=[select Account_Name__r.Id from AccountLookup__c where Account_Name__r.Id in :AccountIds];

    system.debug('listOfAccountLookup'+listOfAccountLookup);

    //deleting child records

    delete listOfAccountLookup;
HI i am having a users who is in high hierachy  having modify all and delete access on opportunity and documents and OWD for opportunities is REad/write,BUt user is not able to delete files on opportunity of his lower level users record.can anyone pls help
i need a formula on process builder,with critriea opportunity stage closed won,Referral (custom field) not null and contract term <3 years

i have conterm term a picklist field with values 12,24,36,48,60,72 all in months

for <3 years one formula
for  3 years one formula and 
for 4+ years one formula

i tired following one,getting error:
AND( 
OR( 
ISPICKVAL([Opportunity].StageName , "Closed Won"), 
OR( 
 NOT ( ISBLANK ( [Opportunity].Referral__c )  ), 
OR( 
ISPICKVAL([Opportunity].ContractTerm__c <36 )) ) 
)
)


please help me in this
 
HI all,
i have custom object called locations which is master detail relationship with opportunities,now i want a button (existing location)on the related list of locations in the opportunitypage.i tired below code:

apex code:
public with sharing class ExiLocExtController {

 

    public Opportunity opportunity  { get; set; }

     

    public ExiLocExtController() {

         

        String OpportunityId = ApexPages.currentPage().getParameters().get('id');

        Opportunity = [SELECT Id, Name, Location__c FROM Opportunity WHERE Id =: OpportunityId];

         

    }

     

    public PageReference save () {

         

        Location__c LOC = new Location__c ( Id = Opportunity.Location__c, Opportunity_Name__c = Opportunity.Id);

         

        try {

            Database.update(LOC);

        } catch (Exception error) {

            ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, 'Error while associating.' + error.getMessage()));
       }

         

        PageReference page = new PageReference('/' + Opportunity.Id);

         

        return page.setRedirect(true);

    }

     

    public PageReference cancel () {

        PageReference page = new PageReference('/' + Opportunity.Id);

        return page.setRedirect(true);        

    }


}
visual page:

<apex:page controller="ExiLocExtController">
 <apex:form >

        <apex:pageblock title="ExistingLocationto test">

            <apex:pageMessages />

            <apex:pageblockbuttons location="top">

                <apex:commandbutton value="save" action="{!save}" />

                <apex:commandbutton value="Cancel" action="{!cancel}"/>

            </apex:pageblockbuttons>

            <apex:pageBlockSection >

                <apex:pageBlockSectionItem >

                    <apex:outputLabel >Opportunity Name</apex:outputLabel>

                    <apex:outputText >{!Opportunity.Name}</apex:outputText>  

                </apex:pageBlockSectionItem>

              <apex:pageBlockSectionItem >

                    <apex:outputLabel >Location__c</apex:outputLabel>

                    <apex:inputField value="{!Opportunity.Location__c}"/>

                </apex:pageBlockSectionItem>               

            </apex:pageBlockSection>

        </apex:pageblock>

    </apex:form>

</apex:page>

i am able to open the page,but that is not saving to the opportunity,kindly help me.
 
HI all,
i have custom object called locations which is master detail relationship with opportunities,now i want a button (existing location)on the related list of locations in the opportunitypage.i tired 

1-) Create a custom related list button in Opportunity as shown below:




2-) Add the url below to your button:

/apex/AssociateOpportunity?id={!Account.Id}

3-) Add the button to the Opportunity's related list in Account's page layout:





4-) Create a custom lookup field for Opportunity in Account (this is a trick to get the lookup field of Opportunity working in the Visualforce). This button won't be visible and will not be added to any layouts and won't include any related list.




5-) Create a controller class (I named it AssociateOpportunityExtController): 
 
01public with sharing class AssociateOpportunityExtController {
02 
03    public Account account  { get; set; }
04     
05    public AssociateOpportunityExtController() {
06         
07        String accountId = ApexPages.currentPage().getParameters().get('id');
08        account = [SELECT Id, Name, Opportunity__c FROM Account WHERE Id =: accountId];
09         
10    }
11     
12    public PageReference associate () {
13         
14        Opportunity opp = new Opportunity ( Id = account.Opportunity__c, AccountId = account.Id);
15         
16        try {
17            Database.update(opp);
18        } catch (Exception error) {
19            ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, 'Error while associating.' + error.getMessage()));
20        }
21         
22        PageReference page = new PageReference('/' + account.Id);
23         
24        return page.setRedirect(true);
25    }
26     
27    public PageReference cancel () {
28        PageReference page = new PageReference('/' + account.Id);
29        return page.setRedirect(true);       
30    }
31     
32}
6-) Create a Visualforce (I named it AssociateOpportunity):
 
01<apex:page controller="AssociateOpportunityExtController">
02    <apex:form>
03        <apex:pageblock title="Associate Opportunity to Custom Object">
04            <apex:pageMessages />
05            <apex:pageblockbuttons location="top">
06                <apex:commandbutton value="Associate" action="{!associate}" />
07                <apex:commandbutton value="Cancel" action="{!cancel}"/>
08            </apex:pageblockbuttons>
09            <apex:pageBlockSection>
10                <apex:pageBlockSectionItem>
11                    <apex:outputLabel>Account Name</apex:outputLabel>
12                    <apex:outputText>{!account.Name}</apex:outputText>  
13                </apex:pageBlockSectionItem>
14              <apex:pageBlockSectionItem>
15                    <apex:outputLabel>Opportunity</apex:outputLabel>
16                    <apex:inputField value="{!account.Opportunity__c}"/>
17                </apex:pageBlockSectionItem>               
18            </apex:pageBlockSection>
19        </apex:pageblock>
20    </apex:form>
21</apex:page>

(i changed objectnames as in above its for different object) after following this getting error "Namespace length cannot exceed 15 chars "..
can any one help pls.
I tired following code :

Trigger CopyopportunityAttachtoAccount on Attachment (after insert)     
{
    set<id> Oppids=new set<id>();
    Map<id, attachment> OpportunityAttachments = new Map<id, attachment>();
    Map<id, Opportunity> OpportunitiesWithAccount = new Map<id, Opportunity>();
    for(attachment an:trigger.new)
    {
        if(an.ParentId.getSobjectType() == Opportunity.SobjectType) OpportunityAttachments.put(an.ParentId, an);
            //Oppids.add(an.ParentId);
    }
    // not required, as using soql 
    // list<Opportunity> OppAccmap =new list<Opportunity>([Select Account.id,Account.name from Opportunity where Id In:Oppids]);

    list<attachment> accatt=new list<attachment>();
    //for(Opportunity Ot:OppAccmap){
    // read "Explanation" why I have replaced Soql For loop with your approach
    if (OpportunityAttachments.keySet().size() > 0) // Read "Explanation" why this check is introduced.
    {
        OpportunitiesWithAccount = new Map<Id, Opportunity>([SELECT Id, Account.id FROM Opportunity WHERE Id IN :OpportunityAttachments.keySet()]);
        // for (attachment am :[select id, name,parentId, body from Attachment where ParentId in :Oppids]) // soql inside for loop is bad, bad thing.
        for (attachment am: OpportunityAttachments.values() ) 
        {
            if (OpportunitiesWithAccount.containsKey(am.ParentId) )
            {
                Attachment newFile = New Attachment(Name = am.name, body = am.body, ParentId=OpportunitiesWithAccount(am.ParentId);
                accatt.add(newFile);
            }
        }
    }
    insert accatt;
}

GETTING ERROE OVER HERE:

Attachment newFile = New Attachment(Name = am.name, body = am.body, ParentId=OpportunitiesWithAccount(am.ParentId);
                accatt.add(newFile);

AND Incorrect SObject type ..PLS DO HELP