• Sarfaraj
  • PRO
  • 2930 Points
  • Member since 2013
  • IBM


  • Chatter
    Feed
  • 88
    Best Answers
  • 0
    Likes Received
  • 3
    Likes Given
  • 4
    Questions
  • 444
    Replies
Hello,

I'm new to writing test cases but this seems fairly straight forward.  I am starting with the following test case and am getting a "List has no rows for assignment to SObject" error when running this very simple test case.
 
@isTest
public class ContactChart_Test {  
    
    static testMethod void findContact ()
    {
           Id contId = [Select Id From Contact Limit 1 ].Id; 
           
        }   
}

 
Hi Everyone,
           Please find my use case given below:

I am dealing with  3 objects : Opportunity,CBS,CAN.

Now both CBS and CAN objects are detail of Opportunity. I want that when CAN record gets created , it takes some of its values from an existing CBS record (which is unique). I have written an apex trigger but have issue with syntax. Please review and let me know what exactly I am doing wrong. The highlighted line is throwing syntax error. 




trigger AutopopulateCanAmount on CAN__c (before insert,before update) {

   List<CAN__c> CanRecords = Trigger.New;
   Set<Id> CanRecordIds = (new Map<Id,SObject>(CanRecords)).keySet();
    
    List<CAN__c> ParentOpportunityRecords = [Select Opportunity__c from CAN__c where Id In:CanRecordIds];   
    Set<Id> ParentOpportunityIds= (new Map<Id,SObject>(ParentOpportunityRecords)).keySet(); 

    
 
       Map<Id,Cost_Breakdown__c> OpportunityCostBreakDownMap = new map<id, Cost_Breakdown__c>();
      OpportunityCostBreakDownMap.putall([Select Id,(Select Base_Award_Fee__c from Cost_Breakdown__r where     Cost_Breakdown_Status__c='Awarded') From Opportunity where Id In:ParentOpportunityIds]);

for (Can__c can :Trigger.new){
c.Base_Award__c=OpportunityCostBreakDownMap.get(c.Opportunity__c).Base_Award_Fee__c;
}
}
how to unable salesforce1 only for using chatter, should not visible data for all users no matters which profile they owned ??
Good Afternoon,

I need to create a trigger for the following requirement.

Add a trigger to Salesforce that automatically converts Account Email address to lower case & updates the Customer ID field with that email address.  Account Email and Customer ID fields are both located on the account page layout (Person Account).

Thank you







 
Hi all,

I'm trying to get the spacing/label text wrap on this page sorted so that the labels associated with outputField values don't wrap. The idea is to have outputField in the left column and the associated inputField value directly across in the right column. Right now, I've got the right column displaying correctly but haven't been able to do the same for the left. VF page & image below.  Any advice would be much appreciated!



<br>label{<br>                color: #30a27c;<br>                font-size: 12px;<br>                font-style: normal;<br>                font-weight: normal;<br>                font-family: PT Sans, sans-serif;<br>                text-align: justify;<br>                white-space: nowrap;<br>                }<br>


         
            
           
           
           
           
           
           
           
           
           
           
         
         
           
           
           
           
           
           
           
           
           
           
           
           
                 
       



User-added image

Thanks,
-Katherine
I am attempting to build a VF page that mimics the HTML below. The HTML works as desired, but something breaks in the translation to apex. Thoughts?

HTML
<!DOCTYPE html>
<html>
<head>

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>

<script>

j$ = jQuery.noConflict();
j$(document).ready(function() {
  j$('[id*=name]').bind('keydown keyup keypress', function() {
    j$('[id*=display]').html(this.value);
  });
});

</script>
</head>
<body>

<input type='text' id='name'>
Your name is <span id='display'/>

</body>
</html>

VF
<apex:page>

<head>

<apex:includeScript value="http://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js" />

<script>

j$ = jQuery.noConflict();
j$(document).ready(function() {
    j$('[id*=name]').bind('keydown keyup keypress', function() {
    j$('[id*=display]').html(this.value);
    });
});
        
</script>

</head>    
  
<body>

<apex:form >
<apex:inputText id="name"/>
</apex:form>

Your name is <apex:outputPanel id="display" />
  
</body>
</apex:page>


 
I'm getting an insufficient privileges error that I cannot understand why.  I have the following pieces of code:
- SalesReportExtension.cls v31
- SalesReport.page v31
- SalesReport.component v31
- Sales_Report.email v31

The user profiles have access to the above code.

Nothing in this code updates or creates Account record however, in-order to run the Sales Report the Profile needs to have Create and Edit rights.  Without both, they will get an insufficient privileges error.  The Account is the Controller but otherwise there are not updates of any object taking place in the code.  It simply is reading sales data associated to the account and summarizing it for the user and allowing them to create a PDF attached to a SF email.  The code works fine as an Admin and it works fine if I give the user Create/Edit rights to the Account.  Help
I am having problems creating this Apex class, a little confused as I have done them before.

Error: Compile Error: Illegal assignment from List<SObject> to List<User> at line 4 column 1

public class LastLogin {
    private String sortOrder = 'LastLoginDate';
public List<User> getUsers() {
List<User> results = Database.query(
        'SELECT FirstName, LastName, Username, MobilePhone, IsActive, LastLoginDate FROM User ' +
        'ORDER BY ' + sortOrder + ' DESC'
        );
    return results;
}
}

Thanks.

So first off I noticed there are built in Lattitute and Longitude fields for Account objects. Do these already get updated when address is filled in? Executing in Query Editor does not seem to give me a value in the Developers Console.

Either way I started building a Geocoding class via google maps and I wanted it to automatically fire when the address of an Account is inserted or updated. 

My Trigger was initially After Update, Insert but I got an error for read only values. I then tried Before Update, Insert which seemed anti intutive but I now get a null value for the ID I think.

My code is below but I essentially just want a way to fire a trigger to update a field in Accounts when the address field in Account is updated or created?

trigger AddLocation on Account (before insert, before update) {
    
    for (Account updatedAccount : Trigger.new) {
       
      // if( (Trigger.oldMap.get(updatedAccount.Id).BillingStreet != 
         // Trigger.newMap.get(updatedAccount.Id).BillingStreet)||( Trigger.oldMap.get(updatedAccount.Id).BillingCity != 
         // Trigger.newMap.get(updatedAccount.Id).BillingCity)||( Trigger.oldMap.get(updatedAccount.Id).BillingState != 
        // Trigger.newMap.get(updatedAccount.Id).BillingState)||( Trigger.oldMap.get(updatedAccount.Id).BillingPostalCode != 
        //  Trigger.newMap.get(updatedAccount.Id).BillingPostalCode)){
              
        Geocoding updater = new Geocoding(updatedAccount.Id);
        
        updatedAccount.BillingLatitude = updater.getLat();
        updatedAccount.BillingLongitude = updater.getLng();
        
            //}
   }     

HI

How to write trigger when contact created from visualforce page automaticaly event also create( on standard contact detail)
Please share a code

Thanks
Hi guys, 
I run into the following issue.

1) I tried to move a new custom object from Sandbox to Production using the change sets
2) When validating I got 2 errors with two of Triggers that don't belong to this object.
3) Read online that the solution is to disable the triggers in Production (I did this by disabling them in sandbox, transferring them to Production using change sets)
4) Did this and with no problem the new custom object passed the test and I was able to deploy it in production
5) As a next step I wanted to activate the triggers in Production so I went to sandbox, activated them, put them in a change set and tried to move them.
Unfortunately when I try to deploy them they don't pass the validation test. 

Before deactivating them the triggers worked perfectly and I didn't touch any of the code.

Here are the errors I am getting:

Class Name: datafloTriggerTest DemoRequestTriggerTest
Method Name: datafloTriggerTest DemoRequestTriggerTest
Error Message: System.DmlException: Upsert failed. First exception on row 0 with id a1n12000000UDgCAAW; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, DemoRequestTrigger: execution of BeforeUpdate caused by: System.DmlException: Delete failed. First exception on row 0 with id 00T1200001lvs5vEAA; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Not allowed to Delete Tasks. Please Contact an Admin to Delete.: [] Trigger.DemoRequestTrigger: line 438, column 1: [] 
Stack Trace: Class.datafloTriggerTest.DemoRequestTriggerTest: line 308, column 1

Class Name: datafloTriggerTest
Method Name: taskDeleteTriggerTest
Error Message: datafloTriggerTest taskDeleteTriggerTest System.DmlException: Delete failed. First exception on row 0 with id 00T1200001lvs5wEAA; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Not allowed to Delete Tasks. Please Contact an Admin to Delete.: [] 
Stack Trace: Class.datafloTriggerTest.taskDeleteTriggerTest: line 193, column 1

Here is one of the Apex trigger code (datafloTriggerTest). It doesn't allow users from deleting Activities after recorded on the Contact object:

1 trigger TaskTrigger on Task (before delete, before insert) 
2{
3//** Before Insert Trigger **************************************************************//
4   if ((trigger.isBefore) && (trigger.isInsert))
5   {
6       for (Task t : trigger.new)
7        {
8            if (t.Type=='Call')
9            {
10                t.Type='Auto Dialer Call';
11            }
12            // Marketo User
13            if (t.CreatedById=='005A0000001Nrgm')
14            {
15                t.Type='Marketing';
16            }
17        }
18    }   
19    
20//** Before Delete Trigger **************************************************************//
21    if ((trigger.isBefore) && (trigger.isDelete))
22    {
23        Profile myProfile;
24        try
25        {
26            myProfile = [SELECT Id,Name
27                        FROM Profile WHERE Id=:UserInfo.getProfileId()];
28        }catch (Exception E){myProfile = new Profile();}
29        
30        for (Task t : trigger.old)
31        {
32            // Non Sys-Admins not allowed to Delete
33            if (myProfile.Name!='System Administrator')
34            {
35                t.addError('Not allowed to Delete Tasks.  Please Contact an Admin to Delete.');
36          }
37        }
38    }
39}

HI ,

i want to use bootstrap modal which on click of custom button "Open modal", itshould open a pop - up ..

i used this code from repositorm bt when i click on button "Open Modal" the pop up dosent work, nothing happens .

any help ?

<apex:page >

<html lang="en">
<head>
  <title>Bootstrap Example</title>
  <meta charset="utf-8"/>
  <meta name="viewport" content="width=device-width, initial-scale=1"/>
 <apex:stylesheet value="{!URLFOR($Resource.bootstrap, 'bootstrap-3.2.0-dist/css/bootstrap.min.css')}"/>
  <apex:includeScript value="{!URLFOR($Resource.bootstrap, 'bootstrap-3.2.0-dist/js/bootstrap.js')}"/> 
    <apex:includeScript value="{!URLFOR($Resource.bootstrap, 'bootstrap-3.2.0-dist/js/bootstrap.min.js')}"/> 
</head>
<body>

<div class="container">
  <h2>Modal Example</h2>
  <!-- Trigger the modal with a button -->
  <button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#myModal">Open Modal</button>

  <!-- Modal -->
  <div class="modal fade" id="myModal" role="dialog">
    <div class="modal-dialog">
    
      <!-- Modal content-->
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal">&times;</button>
          <h4 class="modal-title">Modal Header</h4>
        </div>
        <div class="modal-body">
          <p>Some text in the modal.</p>
        </div>
        <div class="modal-footer">
          <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
        </div>
      </div>
      
    </div>
  </div>
  
</div>

</body>
</html>
</apex:page>
Hello,

This is the trailhead questions which I am trying to solve :

Create an Apex class that returns an array (or list) of formatted strings ('Test 0', 'Test 1', ...). The length of the array is determined by an integer parameter.The Apex class must be called 'StringArrayTest' and be in the public scope.
The Apex class must have a public static method called 'generateStringArray'.
The 'generateStringArray' method must return an array (or list) of strings. Each string must have a value in the format 'Test n' where n is the index of the current string in the array. The number of returned strings is specified by the integer parameter to the 'generateStringArray' method.


Here is my code :

public class StringArrayTest {
    public static List <String> generateStringArray (Integer n) {
       List<String> List1 = new List<String> ();
        for(Integer i=0;i<n;i++) {
          List1.add('\'Test'+ i+'\'' );
  }
        System.debug(List1);
        return List1;
    } 

}


I am getting following error :

Challenge not yet complete... here's what's wrong: 
Executing the 'generateStringArray' method failed. Either the method does not exist, is not static, or does not return the proper number of strings.


I tried it many times but I am not able to solve this problem. Please help. 



 
I have a custom button (close case) that does some validations before a user can go into the close layout screen. The button, behaviour is execute javascript, references a rollup summary field on a releated list. The problem is with the contact center using service cloud. So when i open the case, the rollup summary is 1 for example. I will open up the related list record, which opens on another tab in salesforce, and do an update to the record and save. When i go back to the case tab the value of the rollup field i see is updated to 2. However when I hit custom button, the value of the rollup summary is still 1. It only after  a refresh of the page that the javascript will see the new value.
How can i get the true value without having the user manually refreshing the screen.
 
I can't seem to get a handle on a input field from my javascript function 'checkNumbers.' The initial alert pops up with the onChange event. The second alert pops up but with no value. The field is a percent type so the String() function is used. However, I think the issue is with traversing the objects using $Component. Below is my VF code. Am I traversing this object correctly ?
<apex:page id="page" standardController="Comm_Auto_Audit_Sample_Policy__c"  extensions="AuditCommAutoPolicySampleController"  > 
<script type="text/javascript">
function closepage()
    {
top.window.close();
}
 
</script>

<script>
function checkNumbers() {
alert('Debug 1');
var x = document.getElementById("{!$Component.page.form1.block1.ajaxrequest2.section2.value2}").innerHTML;  
alert(String(x));
}
</script>

<!-- ********************************************** -->

<!--Establish control variables 
The control variables are used to streamline naming conventions and ease rendering references. 
//-->

<!--Set Object reference variable -->
<!-- declare variable for dependency to field in new controller. -->
<apex:variable var="AuditID" value="{!Comm_Auto_Audit_Sample_Policy__c.Audit__c}" />
<apex:variable var="sample" value="{!Comm_Auto_Audit_Sample_Policy__c}" />

<!--Contoller Information variables --> 
<apex:variable var="a" value="{!Audit}" /> 


<!-- ********************************************** -->
<apex:form id="form1">
<apex:pageBlock id="block1" title="Commercial Auto Audit Sample Data (Policy: {!Comm_Auto_Audit_Sample_Policy__c.Policy_Number__c})" >   
<!-- ********************************************** -->

<apex:pageBlockButtons location="top">
<apex:commandButton value="Save" action="{!Save}"/> 
<apex:commandButton value="Save and Return to Template" action="{!saveAndReturn}"/> 
</apex:pageBlockButtons>
 
<!--Debug info for state changes set rendered="true" to enable section -->
<apex:pageBlockSection columns="1" id="testsection1" title="TEST & Debug Section" rendered="false" >
<!--
        ....Parent ID Number is : "{!ParentID}"<br></br>
        ....Personal Auto Product is : "{!PersonalAutoProduct}"<br></br>     
        ....Personal Parent Audit Name is : "{!AuditName}"<br></br> 
//-->
</apex:pageBlockSection>
<script>twistSection(document.getElementById("{!$Component.testsection1}").childNodes[0].childNodes[0]); </script> 
 

<!-- ************************************************************************************************ -->

<apex:outputPanel id="ajaxrequest2">
<apex:pageBlockSection columns="1" id="section2" title="Operations" rendered="{!Operations}" >

<apex:inputField value="{!Comm_Auto_Audit_Sample_Policy__c.Type_of_Operations__c}" id="operation" rendered="{!TypeOfOperations}" > 
    <apex:actionSupport event="onchange" reRender="section2" />
    </apex:inputField>  

<apex:inputField value="{!Comm_Auto_Audit_Sample_Policy__c.Radius_of_Operations__c}" rendered="{!RadiusOfOperations}" > 
    <apex:actionSupport event="onchange" reRender="section2" />
    </apex:inputField>
<apex:inputField value="{!Comm_Auto_Audit_Sample_Policy__c.Percent_Local__c}" style="color:blue;" rendered="{!CONTAINS(Comm_Auto_Audit_Sample_Policy__c.Radius_of_Operations__c,'Local') && (RadiusOfOperations)}"  />

<apex:inputField value="{!Comm_Auto_Audit_Sample_Policy__c.Percent_Intermediate__c}"  style="color:blue;" id="value2" onchange="checkNumbers();" rendered="{!CONTAINS(Comm_Auto_Audit_Sample_Policy__c.Radius_of_Operations__c,'Intermediate') && (RadiusOfOperations)}"  />

<apex:inputField value="{!Comm_Auto_Audit_Sample_Policy__c.Percent_Long_Haul__c}"  style="color:blue;" id="value1" onchange="checkNumbers();" rendered="{!CONTAINS(Comm_Auto_Audit_Sample_Policy__c.Radius_of_Operations__c,'Long-Haul') && (RadiusOfOperations)}"  >
    <apex:actionSupport event="onchange" reRender="longhaul" />
    </apex:inputField>

</apex:pageBlockSection>
</apex:outputPanel>

</apex:pageBlock>
</apex:form>
</apex:page>

 
In my Org we have a picklist field for our opportunity statuses. There's a workflow that moves the stage to 'Awarded' when the status is set to 'Close-Won.' I have a trigger that creates a custom object when a certain opportunity record type reaches 'Awarded.' I only want one object created. Everything works well as long as users follow the script of moving the status instead of the status and stage. But users always seem to find a way to break what I create (or I just didn't create them well enough).

So here is my trigger:
trigger CreatePMopp on Opportunity (after update) 
{

List<Phasing_PM_Info__c> ppi = new List<Phasing_PM_Info__c>();
List<RecordType> rtypes = [Select Name, Id From RecordType where sObjectType='Opportunity' and isActive=true];
Map<String,String> opportunityRecordTypes = new Map<String,String>{};
    for(RecordType rt: rtypes) opportunityRecordTypes.put(rt.Name,rt.Id);

    for ( Opportunity o : Trigger.new )
        if ((o.RecordTypeId==opportunityRecordTypes.get('RPA Capital')) && ( o.StageName=='Close-Won') && (Trigger.oldMap.get(o.id).Status__c!='Close-Won'))
        {
            ppi.add (new Phasing_PM_Info__C(
                Name = o.Name,
                PM_Opportunity__c = o.Id));
        }
    insert ppi;
}

I could make the workflow trigger a hidden checkbox as well as update the stage, but I wanted something more straighforward. Have any of you been able to solve for this and would be willing to help me out?

Thank you,
Joe Stolz 
Customer has built a u/I for their legacy application (AS400) and renders key sales/order reports to the reps in the field. All I am trying to do this get this as another tab with in their salesforce ORG. Nothing fancy, the data source, the current application what data it pulls all remains as is. I am not trying to replicate the functionality in salesforce (simply put). I know we can this with canvas app. If any of you have done it, kindly expand on it. thank you
 
Regards
 
Vishy
Hello

  I am new SF. I have a requirement, can somebody give me some inputs that how to proceed
1. I need to schedule appointment for the customers and i need to show them in any custom calendar and the calendar should show all the avaiable dates for appointments and the dates where appointments are already enrolled

Regards
rajesh
rajesh
Hi,

Working on the recruitment app. I am having issues with salesforce user licence. Since they provide limited user licences, on page 187 of the app work book, they tell us to login in as different users and test their permissions etc. However, they need salesforce user licence and we run out of it. Then only options are salesforce platform user licence. But this does not work with the permission sets for example. With this option only profile we have access to is "standard platform user".

Is there a difference between standard user and Standard platform user profiles?

Any idea how I can work around this limitation?

Also, I set up the roles and hierarchy. I has set up roles before and now it is gone. Any idea why this happened?
Hi,

I am trying to retrieve components from a managed package. I want to export configurable items from the managed package that I modified in my sandbox to another org. I am receiving the following error,

Failed to process the request successfully. Cause(UNKNOWN_EXCEPTION): null: More than 1 installed package named 'MyNamespace__MyPackage' exists in this organization. Use <namespace_prefix>__<pkg_name> to uniquely identify managed installed packages

I have only one package named MyPackage in my org and I tried both with Namespace and without it.

Thank for your help.

Regards
Mir
Seems like the editor interface is updated to remove all angular brackets (< & >) and all contents enclosed within them. May be a security enhancement. Some of the members may have found this issue while posting codes in the forum. Only solution that I found so far is to html escape your code, i.e. replace all angular brackets with their respective equivalent escaped characters. 

Example:
To post this code:
<style>
      .someClass{
      }
</style>
You have to write,
User-added image

If someone has found any easier way, please share.

--Akram
Hi Everyone,

I have posted an Idea regarding a bug. Please vote for it.

https://success.salesforce.com/ideaView?id=08730000000DnW0AAK

Regards
Akram
Hi 

I have created a custom VF page which opens a modal window with some date field in it. In the modal window I am unable to change the year/month from the dropdown. It is getting reset to the old value immediately. Below is my code,
 
<apex:page standardController="Account">
    <apex:includeScript value="https://code.jquery.com/jquery-2.1.1.min.js"/>
    <apex:includeScript value="https://code.jquery.com/ui/1.11.2/jquery-ui.min.js"/>
    <apex:stylesheet value="https://code.jquery.com/ui/1.11.2/themes/black-tie/jquery-ui.css"/>
    <script>
  $(function() {
        $( "#modalWindow" ).dialog({
        autoOpen: false,
        height: 'auto',
        width: 600,
        modal: true,
        resizable: false 
        });
        
  });
    DatePicker.prototype.position = function (){
    for(var a=0,b=0,c=this.myElement;null!=c&&c!=this.calendarDiv.offsetParent;)
        a+=c.offsetLeft-c.scrollLeft,b+=c.offsetTop-c.scrollTop,c=c.offsetParent;
    b=getObjY(this.myElement)+this.calendarDiv.offsetHeight>Sfdc.Window.getScrollY()+Sfdc.Window.getWindowHeight()?getObjY(this.myElement)-(this.calendarDiv.offsetHeight+120):getObjY(this.myElement)-90;
    c="left";
    LC.isRtlPage()&&(c="right",a=this.calendarDiv.offsetParent.offsetWidth-a-this.myElement.offsetWidth);
    this.shim.setStyle(c,a+"px");
    this.shim.setStyle("top",b+"px");
    }
  </script>
  <style>
   .datePicker
      {
          z-index: 2000;
      }

  </style>
    <apex:pageBlock >
        <apex:pageBlockSection >
            <apex:outputField value="{!Account.Name}"/>
        </apex:pageBlockSection>
        <a href="#" onclick="$('#modalWindow' ).dialog('open');">open</a>
    </apex:pageBlock>
    <div id="modalWindow">
        <apex:form >
            <apex:pageBlock >
                <apex:pageBlockSection >
                    <apex:inputField value="{!Account.SLAExpirationDate__c}"/>
                </apex:pageBlockSection>
                <apex:pageBlockButtons >
                    <apex:commandButton value="Save" action="{!save}" oncomplete="$('#modalWindow' ).dialog('close');" reRender="none"/>
                </apex:pageBlockButtons>
            </apex:pageBlock>
        </apex:form>
    </div>
</apex:page>

--Akram
Hello,

I'm new to writing test cases but this seems fairly straight forward.  I am starting with the following test case and am getting a "List has no rows for assignment to SObject" error when running this very simple test case.
 
@isTest
public class ContactChart_Test {  
    
    static testMethod void findContact ()
    {
           Id contId = [Select Id From Contact Limit 1 ].Id; 
           
        }   
}

 

To complete the ISV modules, are you required to have an ISV account? 
 

Or how do you get a dev org with environment hub?

Hi Everyone,
           Please find my use case given below:

I am dealing with  3 objects : Opportunity,CBS,CAN.

Now both CBS and CAN objects are detail of Opportunity. I want that when CAN record gets created , it takes some of its values from an existing CBS record (which is unique). I have written an apex trigger but have issue with syntax. Please review and let me know what exactly I am doing wrong. The highlighted line is throwing syntax error. 




trigger AutopopulateCanAmount on CAN__c (before insert,before update) {

   List<CAN__c> CanRecords = Trigger.New;
   Set<Id> CanRecordIds = (new Map<Id,SObject>(CanRecords)).keySet();
    
    List<CAN__c> ParentOpportunityRecords = [Select Opportunity__c from CAN__c where Id In:CanRecordIds];   
    Set<Id> ParentOpportunityIds= (new Map<Id,SObject>(ParentOpportunityRecords)).keySet(); 

    
 
       Map<Id,Cost_Breakdown__c> OpportunityCostBreakDownMap = new map<id, Cost_Breakdown__c>();
      OpportunityCostBreakDownMap.putall([Select Id,(Select Base_Award_Fee__c from Cost_Breakdown__r where     Cost_Breakdown_Status__c='Awarded') From Opportunity where Id In:ParentOpportunityIds]);

for (Can__c can :Trigger.new){
c.Base_Award__c=OpportunityCostBreakDownMap.get(c.Opportunity__c).Base_Award_Fee__c;
}
}
Hi,

I am trying to retrieve components from a managed package. I want to export configurable items from the managed package that I modified in my sandbox to another org. I am receiving the following error,

Failed to process the request successfully. Cause(UNKNOWN_EXCEPTION): null: More than 1 installed package named 'MyNamespace__MyPackage' exists in this organization. Use <namespace_prefix>__<pkg_name> to uniquely identify managed installed packages

I have only one package named MyPackage in my org and I tried both with Namespace and without it.

Thank for your help.

Regards
Mir
Hi Team,

I have a exsting html angularJS application. Now my need is I want to implement this application  as a new tab in SFDC.
My HTML source have no change. Is there any way to import my project folder into SFDC.
Could you please suggest an easy way to  resolve this .
how to unable salesforce1 only for using chatter, should not visible data for all users no matters which profile they owned ??
My first AppExchange App:

Salesforce Bulk Object Field Creator app easily imports objects fields from CSV or XLS or XLSX file to Salesforce. It will help Salesforce Administrators and Developers to create upto 500 fields of 16 different field types in single go.


Bulk Object Field Creator

Below is the URL for AppExchange:
https://appexchange.salesforce.com/listingDetail?listingId=a0N30000000qDqqEAE
 
Kindly share your feedback and suggestions for further advancements.

 
Regards
Mohit Bansal
Mobile:+91 995-317-0767
E-Mail: mishu67777@gmail.com
When i am posting code "" is not printing. And Some code is removing automatically. 

Any idea . It look like some issue ?
Seems like the editor interface is updated to remove all angular brackets (< & >) and all contents enclosed within them. May be a security enhancement. Some of the members may have found this issue while posting codes in the forum. Only solution that I found so far is to html escape your code, i.e. replace all angular brackets with their respective equivalent escaped characters. 

Example:
To post this code:
<style>
      .someClass{
      }
</style>
You have to write,
User-added image

If someone has found any easier way, please share.

--Akram
Good Afternoon,

I need to create a trigger for the following requirement.

Add a trigger to Salesforce that automatically converts Account Email address to lower case & updates the Customer ID field with that email address.  Account Email and Customer ID fields are both located on the account page layout (Person Account).

Thank you







 
Hi folks,
           Can anyone tell me how to create the angularjs form in visualforce page?
The form has following fields
number, email, text, textarea and date
I wanna sample code for that..

Thanks in advance
Karthick
Hi.
I am trying to create a word file by visualforce.
I am trying to attach it as an attachement for an accout record.

Everything is working fine, the file is getting generated and getting attached to current account record.
But when I try to open the word file for reading.
it's saying :

User-added image

Can some guide, where I am making the mistake?

Thanks in advance.
=================

Here is the code I ma using:

<apex:page controller="WordAttachementGeneratorController"> 
  <apex:sectionHeader title="Word Example" description="Example of how to attach a Word to a record."/>

  <apex:form >
    <apex:pageBlock title="Word Input">

      <apex:pageBlockButtons >
        <apex:commandButton action="{!saveWord}" />
      </apex:pageBlockButtons>
      <apex:pageMessages />

      <apex:pageBlockSection >

        <apex:pageBlockSectionItem >
            <apex:outputLabel value="File Name" for="pdfName"/>
          <apex:inputText value="{!WordName}" id="pdfName"/>
        </apex:pageBlockSectionItem>

        <apex:pageBlockSectionItem >
            <apex:outputLabel value="Account ID" for="id"/>
          <apex:inputText value="{!parentId}" id="id"/>
        </apex:pageBlockSectionItem>

      </apex:pageBlockSection>

    </apex:pageBlock>
  </apex:form>

</apex:page>
public with sharing class WordAttachementGeneratorController{

  public ID parentId {get;set;}
  public String WordName {get;set;}

  public PageReference saveWord() {

    PageReference pdf = Page.PdfGeneratorTemplate;

    // create the new attachment
    Attachment attach = new Attachment();

    // the contents of the attachment from the pdf
    Blob body;

    try {

        // returns the output of the page as a PDF
        body = pdf.getContent();


    } catch (VisualforceException e) {
        body = Blob.valueOf('Some Text');
    }

    attach.Body =   body;
    // add the user entered name
    attach.Name = WordName ;
    attach.IsPrivate = false;
    // attach the pdf to the account
    attach.ParentId =parentId ; 
    insert attach;

    // send the user to the account to view results
    return new PageReference('/'+parentId);

  }

}
<apex:page standardController="Account"  contentType="application/msword#sfdcsrini.doc" cache="true">

<html xmlns:w="urn:schemas-microsoft-com:office:word">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<body>
<apex:outputText title="Welcome to word"/>
<br/>
<br/>
<apex:pageBlock >
<div style="text-align:left" >
Hello! 
</div>            
</apex:pageBlock>
</body>
</html>
</apex:page>




Posting this in order to help others who, months from now, might Google "OP_WITH_INVALID_USER_TYPE_EXCEPTION" and find this explanation.

 

We wrote an Apex trigger on the User object, to insert a custom object record anytime a user updates their Chatter status.  This was done to fulfill a client's requirement to audit all Chatter activity.

 

The trigger worked fine, until one day the client signed up some Chatter Free users.  When such a user tried to update their status, they got a pop-up with an OP_WITH_INVALID_USER_TYPE_EXCEPTION error.

 

We scratched our collective heads for awhile.  After all, Apex triggers run in "system mode," right?  That is supposed to mean that "object and field-level permissions of the current user are ignored."  And yet this trigger seemed like it was running in "user mode," enforcing restrictions based on who the current user was.

 

The root cause turned out to be that a Chatter Free user cannot be the owner of a custom object record, and SFDC by default sets the current user as a new record's first owner.  We discovered this when we realized, via experiment, that Apex triggers fired as the result of actions by Chatter Free users could definitely update an existing record, but were having problems creating records.

 

So the simple solution was to explicitly set the owner of the new record to some fully-licensed user prior to inserting it.