• Surender
  • NEWBIE
  • 0 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 2
    Likes Received
  • 0
    Likes Given
  • 75
    Questions
  • 24
    Replies
Hi,

We are in the process of enabling critical updates in our production environment. Before activating critical updates we want to ensure what impact it might cause. I have found review description for the 'Enable clickjack protection for non-setup Salesforce pages'. But can you eloborate me that how this critical update impacts environment. Also it would be great that what components/sections that we need to check to avoid impact of this critical update.

Regards
G.Surender

Hi,

 

If we modify related list like dependent opportunities on a opportunity used to update LastModifiedDate on a opportunity and on parent opportunity as well.

 

But today when i modify/delete dependent opportunies on a opportunity then it is not updating the LastModifiedDate on parent opportunities.

 

I have checked this bahaviour in Sandbox environment.

 

Can anyone know the reason for why it is not happening so?

 

Your feedback is appreciated.

 

Regards

Surender

 

Hi,

 

I want to add subscriberId's into a list of Id's.

 

below is the code for the same.

 

List<Id> usr=new List<Id>();
AggregateResult[] sub= [select subscriberId from EntitySubscription group by SubscriberId having count(ParentId)>= 500];
for (AggregateResult ar : sub)
usr.add(ar.get(subscriberId));

 

but i'm getting error like Variable does not exist: subscriberId.

 

Can someone correct the above.

 

Thanks in advance.

Hi,

 

 

I have the below code which will send feed post to some particular user. 

 

 

string msg = 'You have automatically swarmed an Opportunity.'+  '\n' +
                       'Opportunity Name : ' + thisOppty.Name+ '\n' + 
                       'Account : ' + thisOppty.Account.Name + '\n' +
                       'Type : ' + thisOppty.Type + '\n' +
                       'Close Date : ' + dateStr + '\n' +
                       'Owner : ' + thisOppty.Owner.Name;
                                
FeedItem swarmNotification = new FeedItem();
swarmNotification.Type = 'LinkPost';
swarmNotification.ParentId = rule.User__c;
swarmNotification.Title = 'Link to Opportunity Record '+thisOppty.Name+' Swarmed';
swarmNotification.Body = msg;
swarmNotification.LinkUrl = URL.getSalesforceBaseUrl().toExternalForm() + '/' + thisOppty.Id;
feedNotifications.add(swarmNotification);

 

But we have problem with the above like the feed post is sent to particular user and the users who are following that user.

 

Can we send private feed post only to that particular user.

 

Share some code snippets for better understanding.

 


Hi,

 

We want to implement some functionality only for Chatter Free users.


when we create new user, User License has Chatter free and Salesforce picklist values.


But we didn't find User License field in the User object.


We need soql to get only Chatter free users in the Apex, can someone post it.

 

Thanks in Advance.. 

Hi,

 

I'm getting System.LimitException: Too many script statements for the below Apex Code:

 

Apex Code:
public class OpportunitySalesTeamSwarmHelper {

public static void evaluateOpptySalesTeamRules() {

// Get list of Opptys with opp, acc, owner details
List<Opportunity> opptys = [SELECT o.Id, o.Name, o.Type, o.AccountId, Account.Name,Account.OwnerId, Account.JDA_Industry__c,
Account.Named_Account__c,Account.Target_Rating__c, o.StageName, o.Amount,o.CurrencyIsoCode, o.Local_Region_Override__c,o.CloseDate, o.Business_Unit__c,
o.OwnerId, o.Owner.Name, o.Owner.Reports_To__c FROM Opportunity o WHERE o.StageName like 'open'];

// Get list of all rules
List<Opportunity_Swarm_Rule__c> rules = [select Name,type__c, Opportunity_amount__c, Opportunity_stage__c,
Opportunity_type__c, Opportunity_Local__c,Opportunity_Business_Unit__c,JDA_Industry__c, user__c,
ownerId, Notify_on_Swarm__c from Opportunity_Swarm_Rule__c WHERE user__r.IsActive = true];

// Get all subscriptions and put in string concatenating subscriber + object ID
List<EntitySubscription> existingOpptySubs = [select SubscriberId, ParentId from EntitySubscription where ParentId in :opptys];

Set<String> existingOpptySubsIds = new Set<String>();
for (EntitySubscription es:existingOpptySubs) {
existingOpptySubsIds.add((String)es.SubscriberId + es.ParentId);
}//for

List<OpportunityTeamMember> opptySalesTeams = [SELECT UserId from OpportunityTeamMember where OpportunityId in :opptys];

// Create a list of subscripions and chatter feeds and insert them later outside the loop
List<EntitySubscription> subs = new List<EntitySubscription>();
List<FeedItem> feedNotifications = new List<FeedItem>();

// For each oppty check all rules.
// If criteria is satisfied, make the user of rule to follow the opportunity
Integer count = 0;
for (Opportunity thisOppty : opptys) {
count++;
System.debug('The value of Count is'+count);
for (Opportunity_Swarm_Rule__c rule : rules) {

if(rule.Type__c.contains('Opptys where I am an Account Team Member')) {

boolean salesTeamFlag = false;
boolean condition = false;
for (OpportunityTeamMember opptySalesTeam : opptySalesTeams) {
if(rule.User__c == opptySalesTeam.UserId ){
salesTeamFlag=true;
}
if(salesTeamFlag)
break;
}

condition= salesTeamFlag;
System.debug('The value of Condition - Opptys where I am Sales Team Member is : '+condition);

if(condition) {
if (existingOpptySubsIds.contains((string)rule.User__c + thisOppty.Id) == FALSE) {
subs.add(new EntitySubscription(parentId = thisOppty.id, SubscriberId = rule.User__c));
existingOpptySubsIds.add((String)rule.User__c + thisOppty.id);

// Add swarming notification to user's feed
if (rule.Notify_on_Swarm__c == true) {
//displaying close datetime as only date string
Datetime dateTimetemp = thisOppty.CloseDate;
Date dateTemp = Date.newInstance(dateTimetemp.year(),dateTimetemp.month(),dateTimetemp.day());
String dateStr = dateTemp.format();

string msg = 'You have automatically swarmed an Opportunity.'+ '\n' +
'Opportunity Name : ' + thisOppty.Name+ '\n' +
'Account : ' + thisOppty.Account.Name + '\n' +
'Type : ' + thisOppty.Type + '\n' +
'Close Date : ' + dateStr + '\n' +
'Owner : ' + thisOppty.Owner.Name;

FeedItem swarmNotification = new FeedItem();
swarmNotification.Type = 'LinkPost';
swarmNotification.ParentId = rule.User__c;
swarmNotification.Title = 'Link to Opportunity Record '+thisOppty.Name+' Swarmed';
swarmNotification.Body = msg;
swarmNotification.LinkUrl = URL.getSalesforceBaseUrl().toExternalForm() + '/' + thisOppty.Id;
feedNotifications.add(swarmNotification);
}// if 3
}//if 2
}//if 1
}

}//for 2

}//for 1 oppty's
try {
System.Debug('Subscription count : ' + subs.size());
insert subs;
insert feedNotifications;
} catch (DMLException e) {
system.debug('Oppty Swarm subscriptions were not all inserted successfully. Error: '+e);
}//catch
}//evaluateOpptyRules

}//class

 

Below is debug log info:
01:42:46.811|LIMIT_USAGE_FOR_NS|(default)|
Number of SOQL queries: 4 out of 100
Number of query rows: 6698 out of 50000
Number of SOSL queries: 0 out of 20
Number of DML statements: 0 out of 150
Number of DML rows: 0 out of 10000
Number of script statements: 200002 out of 200000 ******* CLOSE TO LIMIT
Maximum heap size: 0 out of 6000000
Number of callouts: 0 out of 10
Number of Email Invocations: 0 out of 10
Number of fields describes: 0 out of 100
Number of record type describes: 0 out of 100
Number of child relationships describes: 0 out of 100
Number of picklist describes: 0 out of 100
Number of future calls: 0 out of 10

 

Can someone look at the code and please share your thoughts to overcome the above exception..

 

Thanks in advance..


Hi,

 

I have below method which is called from a button click in a visualforce page.

 

 public PageReference saveUsePolicy() {

 

       User usr= [SELECT Use_Policy__c from User where Id=:UserInfo.getUserId() and IsActive=true];
        usr.Use_Policy__c = true;
        update usr;
       
        PageReference pageRef = Page.UsePolicySuccess;
        pageRef.setRedirect(false);
        return pageRef;      

}

 

It is updating user record upon button click. Also It is redirected to open new page(UsePolicySuccess).

 

I want that page to be opened in the same page not in a new page(new window).

 

Share your thoughts on this.

 

Thanks in advance..

 

Hi,

 

I want below kind of validation rule.

 

CONTAINS(lower(text(Type__c)), "certain type") && ISBLANK(text(Opportunity_Amount__c))

 

But Type__c is of multi-select pick list, so it is not accepting CONTAINS.

 

Can some one help me how to write same validation rule for multi-select picklist.

 

Your feedback is appreciated.

 

Regards

G. Surender

Hi,

 

How to write Test Case for the below Apex class..

 

public class ABC {

    public PageReference callfun() {
        Boolean flag= false;
        
        User usr= [SELECT Use_Policy__c from User where Id=:UserInfo.getUserId() and IsActive=true];
        
        if(usr.Use_Policy__c) {
            PageReference pageRef = Page.UsePolicySuccess;
            pageRef.setRedirect(true);
            return pageRef;
        } else{
        
           PageReference pageRef = Page.UsePolicyPage;
           pageRef.setRedirect(true);
           return pageRef;       
        }
    }

}

 

Your feedback is appreciated..

Hi,

 

I'm getting System.LimitException in the test case for the below query.

 

User sender = [SELECT Email from USER where Id =: thisOppty.OwnerID];

 

But the above query returns only one record.

 

Need your suggestions to resolve the above..

 

 

 

 

Hi,

 


While creating Home page Components i choose component of Type HTML Area to display it in wide region.

 

From this i want to call Visual Force page for that i wrote like below

 

<HTML>

<a href=URL.getSalesforceBaseUrl().toExternalForm()+'/apex/UsePolicyTest'>Click Here</a>

</HTML>


But it is showing as is in the Home Page and it is not calling VisualForce Page.


Can anyone please share ideas on how to call Visual Force Page from here..

Hi,

 

When the tab gets loaded, how can we call A VisualForce page (with out any actions from side bar).

 

I am able to achieve this by having custom link in the Home tab(in the Side bar) and when the user clicks on the link it is calling that VisualForce page.


But our requirement to achive this without a link click in the sidebar and that VisualForce page has to be called in the Wide Area.

 

Your feedback is appeciated.

Hi,
 
As we are new to salesforce development, can someone briefly explain how we can achive the below urgent requirement.
 
I want to display Use Policy(i.e., check box) as a pop-up as soon as they login to Salesforce for the first time. This should happen for existing users who are going to see Chatter for the first time or new SF users. User should not be able to proceed till the User policy has been accepted. 
Also we need to track the acceptance to the Use Policy(add attribute to User record, maybe date and time to track who has accepted to have read the policy).
 
Also share us with sample code/examples if any..
 
Thanks in advance..

Hi,

 

I want to display Use Policy(i.e., check box) as a pop-up as soon as they login to Salesforce for the first time. This should happen for existing users who are going to see Chatter for the first time or new SF users. User should not be able to proceed till the User policy has been accepted.


Also we need to track the acceptance to the Use Policy(add attribute to User record, maybe date and time to track who has accepted to have read the policy)

 

Please share your thoughts like how can we achive this.

 

Also share us with sample files if any..

 

Thanks in advance..

Hi,
I want to display Use Policy(i.e., check box) as a pop-up as soon as they login to Salesforce for the first time. This should happen for existing users who are going to see Chatter for the first time or new SF users. User should not be able to proceed till the User policy has been accepted. 
Also we need to track the acceptance to the Use Policy(add attribute to User record, maybe date and time to track who has accepted to have read the policy)
Please share your thoughts like how can we achive this. 
Also share us with sample files if any..
Thanks in advance..
 

Hi,

 

Can someone guide us like how can we remove the timestamp from the DateField Value.

 

Ex: Suppose i have Date value like 2011-11-15 00:00:00 then i want to print only 2011-11-15.

 

Please share your thoughts on this.

 

Regards

G. Surender