• Fabrice76
  • NEWBIE
  • 0 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 4
    Replies
Hi,
I've already done it with some "named" sobjects as account or contact, and i've got each time a sobject list associated to display it.
Now, i'd want to display in a grid the SOQL result to edit any (custom) sobjects list. So, i'd like to write a soql query and display (and edit) it in a SINGLE grid.

I thought to parse the fields from the SOQL text, play the query and create a datatable (or an object list) from the queryresult, but is it the right way ?
How can i do this ?
Has anybody done this job or something similar ?

Hi,
I use the soap API in C# to show/edit/update objects in my program.
When i want to update an object (account for example), I've got an error : INVALID_FIELD_FOR_INSERT_UPDATE

Unable to create/update fields: 
LastModifiedDate,
LastActivityDate, 
SystemModstamp,
LastReferencedDate,
LastModifiedById,
LastViewedDate,
CreatedById,
CreatedDate,
... and all my custom fields such as formulas, reference fields
IsDeleted.
Please check the security settings of this field and verify that it is read/write for your profile or permission set.

At first, i have all permissions...

When i get account, i actually get all fields using the results of "describeSObjects" on account.
Even if i don't need all fields (like IsDeleted, SystemModstamp), i need some fields like LastModifiedDate, CreatedDate to show them on a form or on a grid row.
I just want to edit a record, change some (editable) fields and update the record.
Is there a way to do that with this "full Account object" with this R/O fields (that i never modify of course)
or have i to duplicate the record in an another account object only with R/W fields ?

Here is my code to get the record / update the record :

        public SF.Account GetAccountWithId(SF.SforceService aSfdcBinding, string aId)
        {
            SF.Account Result = null;
            string SOQL;
            SF.QueryResult queryResult = null;
            // LstFieldsAccount contains all fields from account
            SOQL = string.Format("select "+String.Join(",", LstFieldsAccount.ToArray())+" from account where Id ='{0}'",aId);
            try
            {
                queryResult = aSfdcBinding.query(SOQL);
                if (queryResult != null)
                {
                    if (queryResult.size > 0)
                    {
                        SF.sObject[] TabRecords = queryResult.records;
                        Result = (SF.Account)TabRecords[0];
                    }
                }
            }
            catch (System.Web.Services.Protocols.SoapException e)
            {
                DoWriteError(string.Format(StringErrorSoapException, e.Message ,e.StackTrace));
            }
            return Result;
        }
   
    public bool DoModifyAccount(SF.SforceService aSfdcBinding, SF.Account aRecord)
        {           
            return DoModifyObject(aSfdcBinding, aRecord);                   
        }
       
        // To save all kinds of sobject
    public bool DoModifyObject(SF.SforceService aSfdcBinding, SF.sObject aRecord)
        {
            bool Result = true;
            try
            {               
                SF.SaveResult[] results = aSfdcBinding.update(new SF.sObject[] { aRecord });
                foreach (SF.SaveResult CurrentResult in results)
                {
                    if (CurrentResult.success)
                    {
                        Console.WriteLine("ID update : " + CurrentResult.id);
                    }
                    else
                    {                       
                        Result = false;
                       
                        SF.Error[] TabErrors = CurrentResult.errors;
                        if (TabErrors.Length > 0)
                        {
                            Console.WriteLine("Error : Unable to update " +
                                  "ID " + ResultatCourant.id + "."
                            );
                            Console.WriteLine("\tError is : (" +
                                  TabErrors[0].statusCode + ") " +
                                  TabErrors[0].message + "."
                            );
                        }
                    }
                }
            }
            catch (System.Web.Services.Protocols.SoapException e)
            {
                Result = false;
                AtlUtil.DoWriteError(string.Format(StringErrorSoapException, e.Message ,e.StackTrace));
            }
            return Result;
        }

Hi,

 

I've got a visual page with Output Fields with inline Edit support and i've got a problem (only) with the text area editing (255).

 

<apex:outputField value="{!c.AtlCampaignMember.Commentaire_future_action__c}" >
<apex:inlineEditSupport event="onClick" showOnEdit="BtnSauver,BtnAnnuler"/>
</apex:outputField>

 

The first time i'm editing a text area in a row of pageblocktable, it's ok, i've got a popup to edit the text area.

 

If i edit a second (or third and so on) text area (in another row), i've got a popup with multiple text area (the previous i edited and the current)...and then it doesn't work well to save.

Is it a bug ? Is there a way to edit this right (without a lot of changes) ?

 

Bug example

Hi,

I'm looking for changing the default highlight background color used with a PageBlockTable.

I haven't seen a special property for the selectedDataRow (like selectedDataRowClasses by example) in apex:PageBlockTable.

 

I use two classes to alternate color (even/odd), but the selected row isn't really visible with the default color (I think it's #E3F3FF ) so i'd want to change it.

 

<apex:PageBlockTable id="TableContact" value="{!Contacts}" var="c" rendered="{!IsContact}" rowClasses="even,odd" >

 

I have a look into the HTML page source and I found a class "highlight" applied on the seledtedrow (i think)

 

I've tried to override this class in my page

 

<style>
.highlight  {background-color: Violet !important;}
</style>

 but it didn't change anything...

 

I also searched on the net with google and i didn't find anything about this possibilities...

 

I only found how to change the current cell background color with an OnMouseMove / OnMouseOut event on the columns

 

<apex:column onmousemove="DoOnMouseMoveOrOutCell(this, '{!HighlightColorCell}')" onmouseout="DoOnMouseMoveOrOutCell(this, '{!IF(!c.IsPresent,'',PresentColor)}')">

 and i added this script function

 

function DoOnMouseMoveOrOutCell(aComponent, aColor)
{
    aComponent.style.backgroundColor = aColor;
}

 

Is it possible to change this (default) color for the entire row and how ?

 

Thanks

I am new to SF. I Just create a C# project and trying connect to Salesforce using Soap API. I down load wsdl to my local drive and add web service.  After successfully adding web service, I can't find login method as show in sample document.  I also try to add web service, which reference partner wsdl by URL, and I can't find login method, either.  Please help. Thanks, K
  • February 17, 2015
  • Like
  • 0
I am adding a trigger to default a Contact owner to the Account owner. It works fine and passes the test I wrote for it. HOWEVER, it fails a test from another piece of apex, telling me:

System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, reassignCtOwnerToAcOwner: data changed by trigger for field Owner ID: owner cannot be blank: []

Here is the trigger I'm trying to deploy:

trigger reassignCtOwnerToAcOwner on Contact (before insert, before update) {

    List<Id> accountIds = new List<Id>();
    Map<Id, Id> accountOwnerIdMap = new Map<Id, Id>();

    // all the accounts whose owner ids to look up
    for ( Contact c : Trigger.new ) {
        accountIds.add( c.accountId );
    }
   
    // look up each account owner id
    for ( Account acct : [ SELECT id, ownerId FROM account WHERE id IN :accountIds ] ) {
        accountOwnerIdMap.put( acct.id, acct.ownerId );
    }
   
    // change contact owner to its account owner
    for ( Contact c : Trigger.new ) {
        c.ownerId = accountOwnerIdMap.get( c.accountId );
    }
}

Here is the test class for the OTHER trigger that fails when I try to insert a contact:

public static testMethod void validateContactCountsAndActivities() {

        //Create Account
  Account ac = new Account(
   Name='Test Account',
   Initial_Lead_Source__c='Cold Call',
   Initial_Lead_Source_Detail__c='Cold Call',
   Account_Type__c='Prospect',
   Account_Status__c='Not Contacted'   );
  insert ac;

        //Create Contact
        Contact ct = new Contact(
                LastName='Test Contact',
                Email='testcontact@email.com',
                Account= ac);
        insert ct;



Hi,
I use the soap API in C# to show/edit/update objects in my program.
When i want to update an object (account for example), I've got an error : INVALID_FIELD_FOR_INSERT_UPDATE

Unable to create/update fields: 
LastModifiedDate,
LastActivityDate, 
SystemModstamp,
LastReferencedDate,
LastModifiedById,
LastViewedDate,
CreatedById,
CreatedDate,
... and all my custom fields such as formulas, reference fields
IsDeleted.
Please check the security settings of this field and verify that it is read/write for your profile or permission set.

At first, i have all permissions...

When i get account, i actually get all fields using the results of "describeSObjects" on account.
Even if i don't need all fields (like IsDeleted, SystemModstamp), i need some fields like LastModifiedDate, CreatedDate to show them on a form or on a grid row.
I just want to edit a record, change some (editable) fields and update the record.
Is there a way to do that with this "full Account object" with this R/O fields (that i never modify of course)
or have i to duplicate the record in an another account object only with R/W fields ?

Here is my code to get the record / update the record :

        public SF.Account GetAccountWithId(SF.SforceService aSfdcBinding, string aId)
        {
            SF.Account Result = null;
            string SOQL;
            SF.QueryResult queryResult = null;
            // LstFieldsAccount contains all fields from account
            SOQL = string.Format("select "+String.Join(",", LstFieldsAccount.ToArray())+" from account where Id ='{0}'",aId);
            try
            {
                queryResult = aSfdcBinding.query(SOQL);
                if (queryResult != null)
                {
                    if (queryResult.size > 0)
                    {
                        SF.sObject[] TabRecords = queryResult.records;
                        Result = (SF.Account)TabRecords[0];
                    }
                }
            }
            catch (System.Web.Services.Protocols.SoapException e)
            {
                DoWriteError(string.Format(StringErrorSoapException, e.Message ,e.StackTrace));
            }
            return Result;
        }
   
    public bool DoModifyAccount(SF.SforceService aSfdcBinding, SF.Account aRecord)
        {           
            return DoModifyObject(aSfdcBinding, aRecord);                   
        }
       
        // To save all kinds of sobject
    public bool DoModifyObject(SF.SforceService aSfdcBinding, SF.sObject aRecord)
        {
            bool Result = true;
            try
            {               
                SF.SaveResult[] results = aSfdcBinding.update(new SF.sObject[] { aRecord });
                foreach (SF.SaveResult CurrentResult in results)
                {
                    if (CurrentResult.success)
                    {
                        Console.WriteLine("ID update : " + CurrentResult.id);
                    }
                    else
                    {                       
                        Result = false;
                       
                        SF.Error[] TabErrors = CurrentResult.errors;
                        if (TabErrors.Length > 0)
                        {
                            Console.WriteLine("Error : Unable to update " +
                                  "ID " + ResultatCourant.id + "."
                            );
                            Console.WriteLine("\tError is : (" +
                                  TabErrors[0].statusCode + ") " +
                                  TabErrors[0].message + "."
                            );
                        }
                    }
                }
            }
            catch (System.Web.Services.Protocols.SoapException e)
            {
                Result = false;
                AtlUtil.DoWriteError(string.Format(StringErrorSoapException, e.Message ,e.StackTrace));
            }
            return Result;
        }

Hi,

I'm looking for changing the default highlight background color used with a PageBlockTable.

I haven't seen a special property for the selectedDataRow (like selectedDataRowClasses by example) in apex:PageBlockTable.

 

I use two classes to alternate color (even/odd), but the selected row isn't really visible with the default color (I think it's #E3F3FF ) so i'd want to change it.

 

<apex:PageBlockTable id="TableContact" value="{!Contacts}" var="c" rendered="{!IsContact}" rowClasses="even,odd" >

 

I have a look into the HTML page source and I found a class "highlight" applied on the seledtedrow (i think)

 

I've tried to override this class in my page

 

<style>
.highlight  {background-color: Violet !important;}
</style>

 but it didn't change anything...

 

I also searched on the net with google and i didn't find anything about this possibilities...

 

I only found how to change the current cell background color with an OnMouseMove / OnMouseOut event on the columns

 

<apex:column onmousemove="DoOnMouseMoveOrOutCell(this, '{!HighlightColorCell}')" onmouseout="DoOnMouseMoveOrOutCell(this, '{!IF(!c.IsPresent,'',PresentColor)}')">

 and i added this script function

 

function DoOnMouseMoveOrOutCell(aComponent, aColor)
{
    aComponent.style.backgroundColor = aColor;
}

 

Is it possible to change this (default) color for the entire row and how ?

 

Thanks