• sreenivasApps
  • NEWBIE
  • 30 Points
  • Member since 2013

  • Chatter
    Feed
  • 1
    Best Answers
  • 1
    Likes Received
  • 1
    Likes Given
  • 22
    Questions
  • 24
    Replies
what actions do we have to take ?
what errors it will throw ? and how to rectify them ?
I have a Process builder on case that invokes flow which updates a case with contact details. 
When case is created manually, it is working fine. When a case is created from site it is throwing above error.

i have given the following permissions
Contact - read
Account - read
Case - read, create
and Run flow permission in Profile for the guest user.
Hi Team,

I have created a quick action on Case. When it is clicked i am creating a case of a record type. It is working fine in Sandbox but in Production it is throwing error "you don't have permission to do this" for a user. Working fine for Administrator in Prod.

i checked object level permissions, field level permissions but could not find the problem.

 
Hi,
how can we use elasticsearch in salesforce. We want to push data from salesforce to elasticsearch. And there will be a visualforce page where we want to search data in elasticsearch and dispaly them on the page.

Could any one provide any documentation.
Hi Guys,
I have a requirement, When we select otherthan a Case on RelatedTo field it should throw error on the same page i.e Send an Email Task page.

The rule is not firing at all. for trial and error i just tried by modifying the rule like " WhatId != Null ". So when we select any id in RelatedTo field it should throw error but its not throwing.

But when i am trying to create a "Log a Call" task , then its firing the validation. Why it is happening ?

So i write a trigger on Task,
event 'before insert' and trigger fires the validation on the next page not on the same page like
"
Validation Errors While Saving Record(s)
There were custom validation error(s) encountered while saving the affected record(s). The first validation error encountered was "Please select a case...". 
Click here to return to the previous page.
"

How can i achieve this ?
 
i want to hide or desable edit and delete links from a related list but i don't want to remove their permissions.

when i used the below code, its showing objectHtml collection and length is 0 so its not entering in to the loop. 

<apex:page >
<script> 
window.onload = function(){
 var userProfile = 'System Administrator'; 
  if(userProfile = 'System Administrator')      
  {
  var divObj = document.getElementsByClassName('bRelatedList');
  alert(divObj);
  if(divObj != null && divObj.length)
  {         
  for(var i=0;i<divObj.length;i++)
  {
  var items = divObj[i].getElementsByTagName("a");
  if(items != null )
  {
  for(var j=0;j<items.length;j++)
  {    
  if(items[j].innerHTML=='Del')
  {    
  items[j].style.display = "none";
  }    
  }         
  }         
  }
  }    
  var btns = document.getElementsByClassName("btn");
  if(btns != null )    
  {    
  for( var i=0;i<btns.length;i++)
  { if(btns[i].name == 'delete' || btns[i].name == 'del')    
  {    btns[i].style.display = "none";    }    
  }
  }  
    }};
</script>
</apex:page>
Below is my code written in html homepage component, i need logged in user profile. 

<script src="/soap/ajax/28.0/connection.js" type="text/javascript"></script>
<script src="/soap/ajax/28.0/apex.js" type="text/javascript"></script>
<script type="text/javascript">
  setTimeout( function()
    {
     alert('entered in function'); 
     var userProfile = sforce.apex.execute("UserProfileName", "getLoggedInUserProfile", {});                       
     alert('userProfile'+userProfile); 
    if(userProfile != 'System Administrator')
    {
          var divObj = document.getElementsByClassName('bRelatedList');
          if(divObj != null){
          for(var i=0;i<divObj.length;i++)
          {
                var items = divObj[i].getElementsByTagName("a");
                if(items != null )
                {
                       for(var j=0;j<items.length;j++)
                       {
                              if(items[j].innerHTML=='Del')
                               {
                                   items[j].style.display = "none";
                               } 
                       }
                 }
         }  
   }
  alert('exit from function'); 
  }, 1000);
</scrip>

first alert is getting displayed but from apex execute statement it is not executing.

here UserProfileName is class and getLoggedInUserProfile is static webservice method. when i call this method from console it is executing. 

what is the wrong in my code i am not understanding why it is not calling the class ? please

how to get Site Url in HomePage component . 

 

Thanks in advance.

After adding component to Home page layout . it is not displaying on Home page . I have given view permissions on Artcles , Knowledge Articles . 

i added Portal Article Search component to the Layout which is used in the Profile . Still it is not displying the 

'Portal Article Search' component in Home Page.

how to integrate salesforce with Lucy payment gateway . I am not even getting a link for this to explore on this gateway . Can anyone please post it ASAP .

Below is my code . i just want to display a vertical bar chart categerised by location . here location is a custom object .

legend is not displaying all categery colors , only one color is displaying like "bluecolor - data" . why? 

 

page:

---------- 

<apex:page controller="barChartController" title="Bar Chart">
<apex:chart height="300" width="700" data="{!barData}" legend="true" >
<apex:barSeries colorSet="#0b6fce,#e27001,#78c953" colorsProgressWithinSeries="true" stacked="false" orientation="vertical" axis="bottom" xField="name" yField="data">
<apex:chartTips height="20" width="120"/>
</apex:barSeries>

<apex:axis type="Category" position="bottom" fields="name" title="location" grid="false" dashSize="1"/>

<apex:axis type="Numeric" position="left" fields="data" title="employees" grid="true" gridFill="true" steps="1"/>
<apex:legend position="right" />

<apex:lineSeries title="Closed-Won" axis="left" xField="name" yField="data"/>
<apex:lineSeries title="Closed-Lost" axis="left" xField="name" yField="data"/>
</apex:chart>
</apex:page>

 

class :

----------------------

 

public class barChartController
    {
    public List<wrapper> getBarData()
    {
         list<location__c> l = [select id,name,no_of_employees__c,(Select Name From Employees__r) from location__c];
         System.debug('--------------->'+l[0].no_of_employees__c);
         List<wrapper> data = new List<wrapper>();
         for(location__c loc: l)
               data.add(new wrapper(loc.name,loc.no_of_employees__c));
    return data;
    }

// Wrapper class
public class wrapper
{
    public String name { get; set; }
    public decimal data { get; set; }
    public wrapper(String name, decimal data)
    {
    this.name = name;
    this.data = data;
    }
}
}

Below is my code . i just want to display a vertical bar chart categerised by location . here location is a custom object .

legend is not displaying all categery colors , only one color is displaying like "bluecolor - data" . why? 

 

 

<apex:page controller="barChartController" title="Bar Chart">
<apex:chart height="300" width="700" data="{!barData}" legend="true" >
<apex:barSeries colorSet="#0b6fce,#e27001,#78c953" colorsProgressWithinSeries="true" stacked="false" orientation="vertical" axis="bottom" xField="name" yField="data">
<apex:chartTips height="20" width="120"/>
</apex:barSeries>

<apex:axis type="Category" position="bottom" fields="name" title="location" grid="false" dashSize="1"/>

<apex:axis type="Numeric" position="left" fields="data" title="employees" grid="true" gridFill="true" steps="1"/>
<apex:legend position="right" />

<apex:lineSeries title="Closed-Won" axis="left" xField="name" yField="data"/>
<apex:lineSeries title="Closed-Lost" axis="left" xField="name" yField="data"/>
</apex:chart>
</apex:page>

 

and the class is:

public class barChartController
    {
    public List<wrapper> getBarData()
    {
         list<location__c> l = [select id,name,no_of_employees__c,(Select Name From Employees__r) from location__c];
         System.debug('--------------->'+l[0].no_of_employees__c);
         List<wrapper> data = new List<wrapper>();
         for(location__c loc: l)
               data.add(new wrapper(loc.name,loc.no_of_employees__c));
    return data;
    }

// Wrapper class
public class wrapper
{
    public String name { get; set; }
    public decimal data { get; set; }
    public wrapper(String name, decimal data)
    {
    this.name = name;
    this.data = data;
    }
}
}

i have created 3 tabs and i have previous and next  links on bottom of the page .  so when next link is clicked next tab should be opened in the same way previous link is clicked previous tab has to be opened . 

i want to send "request update" for a contct . so when i click on "request update" button on a perticular contact then i'm getting  this error 

Insufficient Privileges You do not have the level of access necessary to perform the operation you requested. Please contact the owner of the record or your administrator if access is necessary. 

have to create new user with required information . so while creating how to give user profileId , user licenseId all those things ...

 

 

trigger opprolechangeusertrig on User (after update) {
user u = trigger.new[0];
user u2 = trigger.old[0];
list<Id> lst = new list<Id>();

if(u2.UserRoleId!= u.UserRoleId)
{
lst.add(u.Id);
userrolechangetrigcls.usercls(lst);
}
}

After adding component to Home page layout . it is not displaying on Home page . I have given view permissions on Artcles , Knowledge Articles . 

I have a Process builder on case that invokes flow which updates a case with contact details. 
When case is created manually, it is working fine. When a case is created from site it is throwing above error.

i have given the following permissions
Contact - read
Account - read
Case - read, create
and Run flow permission in Profile for the guest user.

I have a custom object called "Job" and contract is the parent object of Job.

Now what i want is on the contract detail page on the related list of Job object I need one custom button and when i click on that button i want ot prepopulated some fields value on the jobs standard edit page. 

I want this functioanlity in lightning Experience.

We can do this easily in Salesfore classic using URL hacking but URL hacking is not possible in lighting experience.

So i need a workaround for this that how can i do this in lightning experince.

I have heard that if we need to pepopulated fields values in lightning experience then we need to use Quick action. but quick action buttons are avalible on the objects detail page and i want that button on the Job related list.

Can anyone help me how we can achieve this or any workaround for this 

 

Thanks you in advance 

Hi Team,

I have created a quick action on Case. When it is clicked i am creating a case of a record type. It is working fine in Sandbox but in Production it is throwing error "you don't have permission to do this" for a user. Working fine for Administrator in Prod.

i checked object level permissions, field level permissions but could not find the problem.

 
Hi Guys,
I have a requirement, When we select otherthan a Case on RelatedTo field it should throw error on the same page i.e Send an Email Task page.

The rule is not firing at all. for trial and error i just tried by modifying the rule like " WhatId != Null ". So when we select any id in RelatedTo field it should throw error but its not throwing.

But when i am trying to create a "Log a Call" task , then its firing the validation. Why it is happening ?

So i write a trigger on Task,
event 'before insert' and trigger fires the validation on the next page not on the same page like
"
Validation Errors While Saving Record(s)
There were custom validation error(s) encountered while saving the affected record(s). The first validation error encountered was "Please select a case...". 
Click here to return to the previous page.
"

How can i achieve this ?
 
We are receiving the following error message from one of the Apex Triggers set up by a consultant:

Apex script unhandled trigger exception
TaskBeforeInsertUpdate: execution of BeforeInsert
caused by: System.NullPointerException: Attempt to de-reference a null object
Trigger.TaskBeforeInsertUpdate: line 61, column 1

I have also attached line 61 of the code in the system. Can someone tell me what is causing this error?

                    t.Subject = t.Subject + ' - ' + IdContactMap.get(t.WhoId).Name;
guys I'm sorry for consecutive post of questions.
I'm new in Apex, this is the first language I'm trying to learn, bear with me please :D I'll treat beer and ice cream (whoa great combination!) if you get this. :D

I'm trying to create a trigger that worked like a rollup summary field, I wanted to calculate the summation of "total revenue" (custom field on a custom object)  of all the related records to show on the Account(master) (lookup relationship). but before that I wanted to count first how many related records are there. I have a custom field name revenue on the Account. I want to place here the count of related record. Here are the code I have but it doesn't populate the field. The code only counts the related record, I'll create a new code to calculate the total revenue.

trigger projRev on Project__c (after insert, after update, after delete, after undelete) {
                          
List<Project__c> newProject = new List<Project__c>();
Set<Id> AccId = new Set<Id>();                                      
                                      
for (Project__c newProj : trigger.new) {
    if(newProj.Account__r != null) {
        AccId.add(newProj.Account__r.Id);
        newProject.add(newProj);
        }      
    }                  

List<Project__c> exProj = [Select Id from Project__c where Project__c.Account__r.Id IN :AccId];
integer treat = exProj.size();

    for (Project__c newProjs : newProject) {
    newProjs.Account__r.Revenue__c = treat;
       
       
}




}
Hello!

I would like to use the apex data loader to insert records to an object that is derived from a parent object. That is, given a parent object, I'd to insert a few children to that parent. However, I'd like to point to the parents by a "Name" or something human readable rather than "Id" which is abstract. Can I possibly do this? I can certainly export attributes that are not ID by using say, Child_Parent__R.Name, but when I use the same in field mapping, I get the error saying that "Field Mapping is invalid". Is there a workaround?

Thanks!
Sam

Hi Experts,

 

I have a custom field of type picklist in User object. I need users to change the value of this field using a custom sidebar widget. The widget just needs to have a picklist custom field with data and a save button which will save the value in the User object.

How can I possibly achieve this functionality. Please suggest.

 

Thanks & Regards,

Nitesh Saxena

I am new to write trigger. how to write a trigger to retrieve last 7 yrs old data and have to purge the data? If any one have the code please share. It will be very helpful for me.
Hi

I am trying to query contactid of logged in user like this.
But i dont see any value.
Where am i going wrong??
 
Id Uid=UserInfo.getUserId();
//DEBUG HERE GETS LOGGED IN USER ID
string contid='select contactid from user where id = '+ Uid + '';
//DEBUG HERE IN CONSOLE SHOWS 1 record BUT VALUE SEEMS TO BE NULL.
List<accountcontactrole> acr =[select accountid,Account.name from accountcontactrole where contactid =:contid];
//DEBUG HERE IS EMPTY LIST.
Thanks in advance!!
 
Hi,
I'd like to set up the email notification for the task update. Once the Comments or Status field in the existing task has been updated by someone else, it can trigger the email notification to send to the task owner. Can it be done by the Apex Coding? 
i want to hide or desable edit and delete links from a related list but i don't want to remove their permissions.

when i used the below code, its showing objectHtml collection and length is 0 so its not entering in to the loop. 

<apex:page >
<script> 
window.onload = function(){
 var userProfile = 'System Administrator'; 
  if(userProfile = 'System Administrator')      
  {
  var divObj = document.getElementsByClassName('bRelatedList');
  alert(divObj);
  if(divObj != null && divObj.length)
  {         
  for(var i=0;i<divObj.length;i++)
  {
  var items = divObj[i].getElementsByTagName("a");
  if(items != null )
  {
  for(var j=0;j<items.length;j++)
  {    
  if(items[j].innerHTML=='Del')
  {    
  items[j].style.display = "none";
  }    
  }         
  }         
  }
  }    
  var btns = document.getElementsByClassName("btn");
  if(btns != null )    
  {    
  for( var i=0;i<btns.length;i++)
  { if(btns[i].name == 'delete' || btns[i].name == 'del')    
  {    btns[i].style.display = "none";    }    
  }
  }  
    }};
</script>
</apex:page>
Hello,

I was told I could use Visualforce to allow Contacts with a certain criteria to show on the their associate Account List. I'm not exactly sure where to start or which Standard Controller I should be using. Can anyone help me out? 

Thanks, 
Can any one help me out .How to show current and future year data in visual force page pdf format .Based on the query i get the data retrived for the current year (2014 )and When i add the data for the year (2015) it gets added it the year (2014) but the data should get displayed separately .
Any Example,Any Suggestion .I shall appreciate your help.
This is the Table (expected output)
ProductName         Year       Q1       Q2   Q3    Q4       Total
 BXRC-25e4000-F-04  2014       100     200   300   400       1000 
                    2015       100                            100  
 BXRC-25e4000-F-23  2014       200                 200        400
                    2015       300                            300
 Subtotal ------------         700     200   300   600       1800

But i get the o/p as:
ProductName         Year       Q1       Q2   Q3    Q4       Total
 BXRC-25e4000-F-04  2014       500     200   300   400       1400 

 BXRC-25e4000-F-23  2014       200                 200        400

Subtotal ------------          900     200   400   800       1800

 
  • April 01, 2015
  • Like
  • 0

Hello All.

 Here is the challenge which i need to implement and looking for a solution approach. 

I need to implement a custom VF Page Search Functionality inside Salesforce. The Data is inside Elastic Search which is a open source Search & Analytic engine. The Elastic Search is inside our Company's network. I have the API to access using JSON & I'm able to do it using a REST based tool. 

Now, Since Salesforce is outside our Company's network i need to authenticate using Ping Identity & then access Elastic Search API. 

I'm really not sure about how this authentication works since the first call will be from Salesforce everytime. Can someone please help. I'm unsure if this will be using SSL or OAuth etc.

Thanks, 

Shri.

how to get Site Url in HomePage component . 

 

Thanks in advance.

After adding component to Home page layout . it is not displaying on Home page . I have given view permissions on Artcles , Knowledge Articles . 

how to integrate salesforce with Lucy payment gateway . I am not even getting a link for this to explore on this gateway . Can anyone please post it ASAP .

Hi.

In the VF I used the date format as YYYY-MM-dd in the 
<apex:outputText value="{0,date,YYYY/MM/dd}">
Before the last week of the year it was OK. When the new year falls in the  last week of Decemeber comes the issue.
For example
2014:
S   M  T  W Th F Sat
28 29 30 31 1   2 3

In the above calendar 1st Jan of 2015 falls in the Thurusday.So when I viewd the records of 28,29,30 of December 2014 It showed as
2015-12-28
2015-12-29
2015-12-30
2015-12-31

After that I came to know that
@"YYYY" is week-based calendar year.
@"yyyy" is ordinary calendar year.
http://realmacsoftware.com/blog/working-with-date-and-time

cheers
suresh