• Patcs_1
  • NEWBIE
  • 255 Points
  • Member since 2013
  • Salesforce Developer


  • Chatter
    Feed
  • 7
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 15
    Questions
  • 86
    Replies
I am working in Trailhead on the "Learn CRM Essentials > Leads & Opportunities > Creating a Sales Process and Using Opportunities" module. I try to create the opportunity in the challenge and I get this error:
Apex script unhandled trigger exception by user/organization: 005360000024JQO/00D36000001DoTh
ClosedOpportunityTrigger: execution of AfterInsert
caused by: System.NullPointerException: Attempt to de-reference a null object
Trigger.ClosedOpportunityTrigger: line 9, column 1

What am I doing wrong? How do I fix this? Help.
Is there any way I can achieve the functionality of MySQL LIMIT with SOQL ?  For example to replicate the current code:
 
    $rs = mysql_query("select count(*) from users");
	$row = mysql_fetch_row($rs);
	$result["total"] = $row[0];
	$rs = mysql_query("select * from users limit $offset,$rows");
	
	$items = array();
	while($row = mysql_fetch_object($rs)){
		array_push($items, $row);
	}
	$result["rows"] = $items;

	echo json_encode($result);
The bit I need help with is the SQL  "select * from users limit $offset,$rows"  .  $offset and $rows are parameters which represent a selection of the returned records - say your SOQL without the parameters returns 2K records you could then generate JSON for records  200 to 500 , 500 to 700 etc and pass these into a javascript data grid.

Any thoughts or advice on this very welcome !
 
Hey!
I am trying to create a VP Dashboard that will have a Dropdown for Time Frame and update the reports for Qtr and Year based on button pressed.
(I decided just to have each button call a different report).
Here is what I have so far but can't seem to figure out how to have the OnClick.
I would want the first form to appear when the Rep presses 'Qtr' and the second form when the Rep presses 'Year'

 
<apex:page standardController="Opportunity" extensions="GaugeChartController">

<body>

<div class="dropdown">
<button onclick="myFunction()" class="dropbtn">Time Frame</button>
  <div id="myDropdown" class="dropdown-content">
    <a href="#quarter">Quarter</a>
    <a href="#Year">Year</a>

  </div>
</div>

<script>

function myFunction() {
    document.getElementById("myDropdown").classList.toggle("show");
}

window.onclick = function(event) {
  if (!event.target.matches('.dropbtn')) {

    var dropdowns = document.getElementsByClassName("dropdown-content");
    var i;
    for (i = 0; i < dropdowns.length; i++) {
      var openDropdown = dropdowns[i];
      if (openDropdown.classList.contains('show')) {
        openDropdown.classList.remove('show');
      }
    }
  }
}
</script>
</body>

<apex:form >
<apex:pageBlock >
    <script>
            myChart.on('beforeconfig', function(config) {
            config.axes[0].margin=-20; 
        });
    </script>
    <apex:pageBlockSection title="My Won Opportunities" columns="2" collapsible="true">
    <apex:chart name="Sales v Goal" height="300" width="400" animate="true" data="{!data}">
        <apex:axis type="Gauge" position="gauge" title="Closed Won Opportunities -Amount"  minimum="0" maximum="30000" steps="5"/>
        <apex:gaugeSeries dataField="size" donut="40" colorSet="#78c953,#ddd"/>
    </apex:chart>
        <apex:chart name="ARR v Goal" height="300" width="400" animate="true" data="{!data}">
        <apex:axis type="Gauge" position="gauge" title="Closed Won Opportunities - ARR"  minimum="0" maximum="25000" steps="5"/>
        <apex:gaugeSeries dataField="size" donut="40" colorSet="#78c953,#ddd"/>
    </apex:chart>
    </apex:pageBlockSection>
</apex:pageBlock>
</apex:form>

<apex:form >
      <apex:pageBlock title="My Opportunities"> 
           <apex:pageBlockSection title="My Open Opportunities" columns="2" collapsible="false">              
            <analytics:reportChart reportId="00O26000000PeMT" size="medium"></analytics:reportChart>
            <analytics:reportChart reportId="00O26000000PeMY" size="medium"></analytics:reportChart>
              </apex:pageBlockSection> 
         </apex:pageBlock> 
</apex:form>

 
Hi,

I'm having a VF page with two fields Start Date & End Date.
Using date picker I'm getting the calendar, But the problem is when I open that page automatically Start date , End date values must be populated based on the current month.
For example: If I go to that VF page, as this month is september , start date must be 9/1/2016, End date must be 30/1/2016.
First date and Last date of the current month must be populated. 
Please help me
I know I need a loop in here somewhere to loop through this list, but I can't get it right. I get" initial term of field expression must be a concrete SObject : list. Can somebody save me please? I'm looking to create a contact from anew user. I know the trigger wont work.

public class createContactFromUser {
    
    public static void ContactCreate(){ 
        List<Contact> ct = new List<Contact>();
        List<User> usr = new List<User>();
        usr=[select id, Name, AccountId, Firstname, Lastname, Email from User                        
                        where profileId ='00et0000000HfNg'
                    and isActive = true];  
        
            System.debug(usr.size());
                 
        if(usr != null && usr.size() > 0) {    
            Contact uc = new Contact();                
                uc.Name = usr.Name;            
              uc.Email = usr.Email;
            uc.AccountId = usr.AccountId;
             ct.add(uc);
        }    
    insert ct;
    }
}
How Can I give the access to the UAT Sandbox for the non-admin users?
  • September 12, 2016
  • Like
  • 0
I have a website created mainly in Site.com, to complete more functions, I used force.com to create several VF pages, and also used "iframe" to embed them into my Site.com pages, the whole process works fine for admins, but not for community user accounts, they can't see visualforce pages content, I've enabled visualforce pages and Apex classes in the related profile setting, still can't work. Plus, I used https://c.cs14.visual.force.com/secur/logout.jsp to implement logout process, it works for admins, but not for community users as well. These two issues have a same access cause, right? Hope to get your answers soon. Thank you in advance.   
Hi

Does any one happen to know about the offers for the products are captured in salesforce in a standard way.

Thanks
 
Hi 

I want to change the API name of artical type, will it change the __kav name also.

Please Advice.

Thanks in advance!
Hi

I was working on the Trial head Apex Rest Callout, I clicked on the check challenge, I received the below error.

Challenge Not yet complete... here's what's wrong: 
There was an unexpected error in your org which is preventing this assessment check from completing: System.NullPointerException: Attempt to de-reference a null object

When I run the test class in the trialhead palygroud I received 100% code coverage.

Can anybody help me on this issue.

Thanks
 
Hi

I am configuring the Live Chat in salesforce and integrating with .Net Application. I am not using Visual force page it is a java script code, which has been given by salesforce.The issue is when the user click on the live chat button in .Net application, the user click that button multiple times and multiple window gets opened. Is there any way to control the multiple chat window.

Any help would be appricated.

Thanks in advance!
Hi 

I am trying to configure the saml integration between salesforce and external application. I am configuring salesforce as IDP. From the external application they are asking for slo url from salesforce i.e Logout URL from IDP. When I confirgured the IDP in connected apps I can able to see the login URL, HTTP POST and HTTP REDIRECT.

I dont know which URL I have to give to them for logout.

can anybody please assit.

Thanks in Advance.
Hi All

I have one question, In my Production there is an connected app and I have Secret and consumer Key for that Application to access production environment of salesforce, but in sandbox I dont have any connected apps still that 3rd party application was able to access the sandbox environment.

so my question is the consumer and secret key are not unique with respect to orgs?
using production consumer and secret key will they access all the sandboxs?

please clarify!

Thanks in Advance!!!
 
Hi

Can anybody please assit me on how to integrate external application with in salesforce.

The business use case is there will a link in salesforce Account page and they need to redirect to external web application with the same User and role previlages.

Thanks in Advance!
Hi

any body knows how to decode the HTML code into text in apex class.

Let me explain my scenario, I have a api call from external system, In that api call they are encoding the scepical charaters it looks like below.

"firstName": "&#1056;&#1080;&#1096;&#1072;&#1090;",
"lastName": "&#1043;&#1072;&#1090;&#1072;&#1091;&#1083;&#1080;&#1085;",

I want to decode this character in to text and store the values in contact object. Currently it is storing with this character. It is not decoding the character.

does anybody have solutions for this.

Thanks in Advance!

 
Hi

If we delete the Account team member records, will it delete the Account share record also?

Thanks in Advance.
  • September 10, 2014
  • Like
  • 0
Hi Guys

I want to update the case access level in Account share object, when I try to update i got the below error "field integrity exception: RowCause (cannot update sharing row with this cause)". when i check the records it has the row cause "Owner" or "Rule". My question is can we update the records with row cause "Owner" or "Rule"?

Thanks in Advance
  • September 04, 2014
  • Like
  • 0
Hi 

can we able to update the Account Share records with row cause "Owner" and "Rule"?

Thanks
  • September 04, 2014
  • Like
  • 0
Hi

I have created a visualforce email Template and sending an email through batch class. I can see the below image in the sent email. I have not added any image in Email Template.

User-added image


Any Help would be appreciated. Thanks in Advance!!!

Hi

I want to display the data which is present in the object in Message and alert section in home page.

i dont know whether it is possible or not, if it is possible pls let me know how it can be done.

Thanks in Advance!!!

Hi All

 

I want to get the deleted Account TeamMember data via SOQL. is there any possibility to do that.

 

Thanks in Advance!!!

 

 

Hi All

 

I want to share the contact using trigger, when i tried the below code i am getting an error "Variable does not exist: ContactAccessLevel at line 29 column 9"

 

trigger ContactMakePublicTrigger on Contact (after insert) {

ID groupId = [select id from Group where Type = 'Organization'].id;
if (Trigger.isInsert) {
List<ContactShare> sharesToCreate = new List<ContactShare>();
for (Contact contact : Trigger.new) {
ContactShare cs = new ContactShare();
cs.ContactAccessLevel = 'Edit';
cs.ContactId = contact.Id;
cs.UserOrGroupId = groupId;
sharesToCreate.add(cs);
}
if (!sharesToCreate.isEmpty())

insert sharesToCreate;

}

 

}

 

Please help me 

 

Thanks in advance.

<apex:page showHeader="false" sidebar="false" controller="OppDetailsCntlr" standardStylesheets="false" >
<apex:stylesheet value="{!URLFOR($Resource.file, 'file/css/box.css')}"/>
  
  <!--This content is displayed in abox -->
  
  <div class="Header">{!$Label.Standard_Header}</div>
  <div class="scrollClass">
  <apex:repeat value="{!OppDetails}" var="details" >      
      <table class="contentTable">
        <tbody>
            <tr>
                <td >{!if(details.typeTitle!='',details.typeTitle,'Classification')}:</td>
                <td>{!details.reqType}</td>
            </tr>
            <tr>
                <td >{!if(details.cornersTitle!='',details.cornersTitle,'Open Corners')}:</td>
                <td>{!details.Corners}</td><br/>
            </tr>
        </tbody>
       </table>
  </apex:repeat> 
  </div>
  
  <!-- Until this part, content is displayed in a box -->
  
</apex:page>


I wrote the above code. I created a box using CSS, in which content will be displayed in the box with a header '{!$Label.Standard_Header}'.  

I'm trying to hide the entire box including header label if there is no content available (Content is dynamic, it will be populated based on opportunity records). Can anyone help me on this?

  • May 08, 2018
  • Like
  • 0
I need to get the data from JSON into salesforce object(custom object).  
Following is the JSON - 
{"EMPL_TYPE":" ","GRADE":"19","STD_HOURS":40.00,"EMPLID":"JCSD"}

I have a custom object in salesforce and I need to get the above values into their respective fields when i click a button on the custom object.
My code is as follows-

public class Empdetails {
public String EMPL_TYPE;
public String GRADE;
public Double STD_HOURS;
public String EMPLID;
public static Empdetails parse(String EMPLID) {
        Http httpProtocol = new Http();
        HttpRequest request = new HttpRequest(); 
        request.setEndpoint('xyz'+EMPLID);
        request.setMethod('GET'); 
        HttpResponse response = httpProtocol.send(request);
        system.debug(response.getBody());
        String jsonString = response.getBody();
        // Parse JSON response to get all the Employee record details
        JSONParser parser = JSON.createParser(response.getBody());
        return (Empdetails) System.JSON.deserialize(EMPLID, Empdetails.class);
    }
}

Actually I'm new to this concept. Am I doing correct ? Please suggest me some inputs.
Thank you 
I am getting an error
System.DmlException: Insert failed. First exception on row 0; first error: INVALID_PARTNER_NETWORK_STATUS, invalid status for partner network operation: []
In my apex test class. i have created an apex batch class for sharing opportunity and have written apex test class for it but i am getting this error. Please suggest if have any solution.
here the test class...

@isTest(SeeAllData = true) public class batchLineItemInsert_Test { static testMethod void testMethod1() { Test.startTest(); Account a = new Account(Name='Acme1', BillingCity='San Francisco'); insert a; PartnerNetworkConnection networkConn =[select Id from PartnerNetworkConnection where ConnectionName = 'Services One' and ConnectionStatus = 'Accepted']; PartnerNetworkRecordConnection newConnection1 = new PartnerNetworkRecordConnection(ConnectionId = networkConn.Id, LocalRecordId = a.Id); insert newConnection1; Opportunity op1 = new Opportunity(Name='ChildTest123',Accountid=a.Id, StageName='2 - Qualified', CloseDate=System.today() - 50,Expected_Product__c=10.0,error_description__c='error',DealID__c='1',Opportunity_Status__c='Active',Position__c='Ministry of Hajj sasulima'); op1.CurrencyIsoCode = 'USD'; insert op1; PricebookEntry pbID= [SELECT Id,Name, PriceBook2Id, Product2Id, CurrencyIsoCode FROM PriceBookEntry where isActive = True and CurrencyIsoCode=:op1.CurrencyIsoCode limit 1]; OpportunityLineItem olli = new OpportunityLineItem (Quantity=2, OpportunityId=op1.Id, TotalPrice=10, PriceBookEntryId =pbID.Id); insert olli; FF_Batch_details__c ffbd = new FF_Batch_details__c(optyId__c=op1.Id, isActive__c=true, isLineItem__c=true); insert ffbd; PartnerNetworkRecordConnection newConnection = new PartnerNetworkRecordConnection(ConnectionId = networkConn.Id, LocalRecordId = olli.OpportunityId, ParentRecordId = op1.AccountId); insert newConnection; batchLineItemInsert obj = new batchLineItemInsert(); DataBase.executeBatch(obj); Test.stopTest(); } }
I have a requirement. I have a object obj1 and another obj obj2 which are not direct related. 
obj1 is related to contact and contact is related to obj2. so now my requirement is 
suppose in obj1 if I am inserting a field f1 , then in obj 2 field2 should add the value which already exists and display the total value.
that means suppose in field f1 contains 100 value and obj2 field2 contains 200 values then it should update the field2 values by adding field1 value and display the total value.
Please try to help me.
Thanks in advance
I have a SOQL query result that is populated using apex page block table. Is there any possible way that the Query result set is put into the List view? if so, kindly provide an example
I have a Visualforce page with a table and would like to add color to my cells and in some cases to my entire row. I don't know what the syntax is to insert the color and what it is I need to insert and where in my table to indicate that I want a particular color either for a cell or for the entire row. Cna someone help me by posting the syntax in the exact format opening and closing statements that I must include for this to go through? Perhaps include a sample color that I could test out.
 
I am working in Trailhead on the "Learn CRM Essentials > Leads & Opportunities > Creating a Sales Process and Using Opportunities" module. I try to create the opportunity in the challenge and I get this error:
Apex script unhandled trigger exception by user/organization: 005360000024JQO/00D36000001DoTh
ClosedOpportunityTrigger: execution of AfterInsert
caused by: System.NullPointerException: Attempt to de-reference a null object
Trigger.ClosedOpportunityTrigger: line 9, column 1

What am I doing wrong? How do I fix this? Help.
In our salesforce application on the accounts and contacts tabs under activity history we have a button "log a call"
When pressed it produces the following page.
You can see there are four record types defined each of which has it's own picklist values.  Conferences is the default value 
initial record type page
After the selection is made we get the page below
If we look at the record type ringed in the top right hand corner it is showing the correct record type
The problem is the scheduled follow up task underneath(ringed in the bottom right corner).  This has gone back to the wrong record type (default conferences).  This subsequently means the picklist values for the follow up task are wrong.
Is there anyway to get the record type for the follow up task the same as the original selection.  I have tried unticking it under define default values of record types and it make no difference 
Any help greatly appreciated as this one driving me mad for days


User-added image
when status__c= true && price__C>3000, update status__c=false and send email using email template to u1@gmail.com using trigger
Is there any way I can achieve the functionality of MySQL LIMIT with SOQL ?  For example to replicate the current code:
 
    $rs = mysql_query("select count(*) from users");
	$row = mysql_fetch_row($rs);
	$result["total"] = $row[0];
	$rs = mysql_query("select * from users limit $offset,$rows");
	
	$items = array();
	while($row = mysql_fetch_object($rs)){
		array_push($items, $row);
	}
	$result["rows"] = $items;

	echo json_encode($result);
The bit I need help with is the SQL  "select * from users limit $offset,$rows"  .  $offset and $rows are parameters which represent a selection of the returned records - say your SOQL without the parameters returns 2K records you could then generate JSON for records  200 to 500 , 500 to 700 etc and pass these into a javascript data grid.

Any thoughts or advice on this very welcome !
 

Two different conditions in one formula field.

IF( 
AND( 
NOT( 
ISBLANK(Under_Current_Contract_Until__c)), 
Under_Current_Contract_Until__c >=TODAY(), 
Owner.LastName <> "Partners"), 
IMAGE("/img/samples/color_red.gif", "red", 30, 30), 
IMAGE("/img/samples/color_green.gif", "green", 30, 30))

I need to incorporate these parameters into the formula
above. These two conditions need to always be red.

RecordType.DeveloperName = "Phase 4,
Owner.LastName <> "Partners"

In other words I need these two parameters to supersede the other conditions.
I have tried OR statements and nested IF statements without success.

Any help would be appreciated. Thanks!
Hi

I tried creating a visual force page directly using  by navigating URL
https://na30.salesforce.com/apex/secondpage , From there I was able to directly create the page using 
Error message


Though I was able to create the page, I could not view the page editor option .
Please help
Hey!
I am trying to create a VP Dashboard that will have a Dropdown for Time Frame and update the reports for Qtr and Year based on button pressed.
(I decided just to have each button call a different report).
Here is what I have so far but can't seem to figure out how to have the OnClick.
I would want the first form to appear when the Rep presses 'Qtr' and the second form when the Rep presses 'Year'

 
<apex:page standardController="Opportunity" extensions="GaugeChartController">

<body>

<div class="dropdown">
<button onclick="myFunction()" class="dropbtn">Time Frame</button>
  <div id="myDropdown" class="dropdown-content">
    <a href="#quarter">Quarter</a>
    <a href="#Year">Year</a>

  </div>
</div>

<script>

function myFunction() {
    document.getElementById("myDropdown").classList.toggle("show");
}

window.onclick = function(event) {
  if (!event.target.matches('.dropbtn')) {

    var dropdowns = document.getElementsByClassName("dropdown-content");
    var i;
    for (i = 0; i < dropdowns.length; i++) {
      var openDropdown = dropdowns[i];
      if (openDropdown.classList.contains('show')) {
        openDropdown.classList.remove('show');
      }
    }
  }
}
</script>
</body>

<apex:form >
<apex:pageBlock >
    <script>
            myChart.on('beforeconfig', function(config) {
            config.axes[0].margin=-20; 
        });
    </script>
    <apex:pageBlockSection title="My Won Opportunities" columns="2" collapsible="true">
    <apex:chart name="Sales v Goal" height="300" width="400" animate="true" data="{!data}">
        <apex:axis type="Gauge" position="gauge" title="Closed Won Opportunities -Amount"  minimum="0" maximum="30000" steps="5"/>
        <apex:gaugeSeries dataField="size" donut="40" colorSet="#78c953,#ddd"/>
    </apex:chart>
        <apex:chart name="ARR v Goal" height="300" width="400" animate="true" data="{!data}">
        <apex:axis type="Gauge" position="gauge" title="Closed Won Opportunities - ARR"  minimum="0" maximum="25000" steps="5"/>
        <apex:gaugeSeries dataField="size" donut="40" colorSet="#78c953,#ddd"/>
    </apex:chart>
    </apex:pageBlockSection>
</apex:pageBlock>
</apex:form>

<apex:form >
      <apex:pageBlock title="My Opportunities"> 
           <apex:pageBlockSection title="My Open Opportunities" columns="2" collapsible="false">              
            <analytics:reportChart reportId="00O26000000PeMT" size="medium"></analytics:reportChart>
            <analytics:reportChart reportId="00O26000000PeMY" size="medium"></analytics:reportChart>
              </apex:pageBlockSection> 
         </apex:pageBlock> 
</apex:form>

 
Hi,

I'm having a VF page with two fields Start Date & End Date.
Using date picker I'm getting the calendar, But the problem is when I open that page automatically Start date , End date values must be populated based on the current month.
For example: If I go to that VF page, as this month is september , start date must be 9/1/2016, End date must be 30/1/2016.
First date and Last date of the current month must be populated. 
Please help me