• Mel Lisau
  • NEWBIE
  • 55 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 2
    Likes Received
  • 0
    Likes Given
  • 23
    Questions
  • 28
    Replies
If i want to creat an Account withe Name lest say "TestAcct1" , how many api calls are made to api to create it ? Does it check existence and if there then update , thats 2 already .
I was after the lifecycle for creating entitites. 
I have a scenario where 1 Account has 50 Contacts and if i wanted to create that then would it do check for existence , update and so on that would make over 100 calls to the api . 
Is there a quicker way to do this ?
I have a Salesforce project. I use SOAP API to login and that is successful. 
When our clients need to construct a query to a sObject they dont know all the field names, relationships etc . So they construct a very minimal query for lets say update / upsert .
What i am hoping to do is give them something like Query Builder Tool. 
So is there a way that I can add this to my Visual Studio project and display the UI to the user ?

Thanks
I am tryng to use OAuth to authenticate rather that the traditional username , password.
I can successfuly authenticate and receive back a Instanceurl and token.

But how can i construct a SOAP call using these ?
I tried to follow this link but there is no example.

https://developer.salesforce.com/blogs/developer-relations/2011/03/oauth-and-the-soap-api.html

I have tried to  make a request as follows:

strng SOAP_API_SOBJECT_ENDPOINT = "/services/Soap/u/51.0/";
string sobject = "Account"
Account acct = new Account { Name = $"Test123  ", Description = $"Test Description 123[" };

          string restendpoint = InstanceUrl + SOAP_API_SOBJECT_ENDPOINT + sobject;
            var json = JsonConvert.SerializeObject(acct);
            var request = new HttpRequestMessage(HttpMethod.Post, restendpoint);
            request.Headers.Add("Authorization", "Bearer " + AuthToken);
            request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
            request.Headers.Add("X-PrettyPrint", "1");
            request.Content = new StringContent(json, Encoding.UTF8, "application/json");
            var response = client.SendAsync(request).Result;
            return response.Content.ReadAsStringAsync().Result;

The result is Internal Server Error.

Is this the correct way to use OAuth with Soap API ?




 
I am new to the Rest API wihin Salesforce and have a few queries.

1) With the Rest API ,do i need to create a connected app within my org before I can connect  and do all users use the same Secret Key ?  
2) What is required to implement OAuth authentication and do i need too ?
3) With the Rest API ,can i still use the SOQL or is there a better feature for  querying data ?
4) Can i query API endpoints and filter the response ?
5) Can i use the Rest Api to integrate data into Salesforce ?



Would one use the Rest API over Soap because SOAP requires downloading a WSDL file, Converting the WSDL files to regular classes and then invoking methods on those objects ?

Thanks
I have custom objects , say     My_Account__c, My_Contact__c , My_Address_c and others. 
I can successfully delete all custom objects , and then I go to run the empty recycle bin by using :

 public void EmptyRecycleBin(String[] ids)
        {
                EmptyRecycleBinResult[] result = _myservice.emptyRecycleBin(ids);
                for (int i = 0; i < result.Length; i++)
                {
                    EmptyRecycleBinResult result = emptyRecycleBinResults[i];
                }           
        }

I get a EmptyRecycleBinResult result of success, but when i go to the Create-Objects, I can see my custom object is deleted , but it remains in the Deleted Objects. I thought the EmptyRecyceBin would purge the objects in there , 
How can i permanently delete these custom objects ? 
I have a destructivechanges and package.xml file+

package.xm
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <version>51.0</version>
</Package>

Destructivechanges.xml

<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types>
        <members>myCustomObject__c</members>
        <name>CustomObject</name>
    </types>
</Package>


I have tried with the latest API Version and even though I have specified only 1 custom Object to delete, it actually deletes all of them and even the flag purgeondelete doesnt actually purge , I still have to manually delete the deleted objects, why is this ?
I have deleted a number of Objects and they have relationships and links. Is there an SOQL call or any other type of way i can make to clear these from the "Deleted Objects" instead of manually going and deleting them ?
I have custom objects in Salesforce that i delete , but if i lok in Salesforce it says "deleted objects(2)". I need to go into there and Erase.
At the moment i am doing the following
custids is a string[] of the salesforce id for that object.

sfservice.DeleteResult[] deleteResult = mysrvc.delete(custids);

and then

sfservice.EmptyRecycleBinResult[] emptyresult= mysrvc.emptyRecycleBin(custids);

But when i look in Salesforce , I can still see the objects as Deleted Objects and I need to go in manually and delete them

How can i delete them permanently ?
I have a SandBox instance and have registered my triggers and classes and the test classes have passed the 75% requirement.
I also have a Production instance and these are now successfully on my Production instance. No problem there.

But in my application I have a connection to my Production instance and if i need to update a trigger in production i delete it (because i dont know what the user has changed) and then try to register , but because it is Production it wont allow me because it needs to pass tests. 
My question is , once the triggers and test classes are registered with Production , can i modify the body of the triggers if required and body of the test classes if required without having to rerun on Sndbox first and then redeploy to Production ?

I have a SOQL call as follows:
select Account.AccountNumber, Account.AccountSource, Account.Active__c, Account.AnnualRevenue, Account.BillingAddress,
Account.CreatedById, Account.CreatedDate, Account.CustomerPriority__c,
Account.Name, Account.NumberOfEmployees, Account.NumberofLocations__c, Account.OwnerId, Account.Ownership, 
 Account.Site, Account.SLA__c, Account.SLAExpirationDate__c, Account.SLASerialNumber__c,
 Account.SystemModstamp, Account.TickerSymbol, Account.Tradestyle, Account.Type, Account.UpsellOpportunity__c, 
   (select Sequence__c, Action__c from AcmeCo_Account_c__r where Processed__c = false and IDM__c = 'TEST1' ) 
from Account where Account.Id in (select Link__c from AcmeCo_Account__c where IDM__c = 'TEST1' and Processed__c = false) 

But it give an error:
(select Sequence__c, Action__c from AcmeCo_Account_c__r where Processed__c
                                    ^
ERROR at Row:17:Column:40
Didn't understand relationship 'AcmeCo_Account_c__r' in FROM part of query call. 
If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. 

The custom table is created . 
How can i avoid this or correct the query ?

thanks

 
I need to sign up a new Organization in Salesforce and do some development in .Net. But i want to know when a user signs up are they given a Production instance and SanbBox instance by default ? or is Production instance by default always given and the user has to set up a SandBox for testing ?
I have the following query:

var queryResult = binding.query("SELECT Id, Username, LastName, FirstName, Name, IsActive FROM User");

I get 7 records , but how can i convert this to a dataset or list or JSON using C# in order to perform Linq operations ?

thanks
Hi , 
I have a Production instance and i need to run api calls but require the  'Manage Sandbox' permission for a user in Production , 
What is the permission and how can i set this withing Production ?

thanks
If i have lets say a Production , SandBox and Developer Edition in Salesforce. Is there a way I can login to one , probably Production and retrieve all instances registered to the Organisation. So logging into Production I can make some sort of ap[i call or apex call that will give me all instances assocaiated to this Organisation. (a link between Prod , Sandbox and Developer)
There is a rest call as follows;
GET /services/data/v40.0/tooling/query/?q=Select+id,SandboxName+from+SandboxInfo
But i am not using rest at the moment , only Soap , can i use an equivalent Soap call ?


Thanks
I am trying to create a test for "after insert" on OrderItem.,
I have so far the following:


@isTest 
 public static testMethod void MyTestOrderItem()   { 
   List<Account> AccountList = new List<Account>();
   Account Account_0 = new Account( Name='NAME1');
   AccountList.add(Account_0);
   Account Account_1 = new Account( Name='NAME2');
   AccountList.add(Account_1);
   insert AccountList;


    Product2 p = new Product2();
    p.Name = ' Test Product ';
    p.Description='Test Product Entry 2';
    p.productCode = 'ABCD';
    p.isActive = true;
    insert p;


   PriceBook2 pb2Standard = [select Id from Pricebook2 where isStandard=true];
   Id pricebookId = pb2Standard.Id;

    // Insert PricebookEntry=
    PricebookEntry standardPrice = new PricebookEntry();
    standardPrice.Pricebook2Id = pricebookId;
    standardPrice.Product2Id = p.Id;
    standardPrice.UnitPrice = 1;
    standardPrice.IsActive = true;
    standardPrice.UseStandardPrice = false;
    insert standardPrice;


  List<Order> OrderList = new List<Order>();
  Order Order_0 = new Order(Pricebook2Id= pricebookId,  Status='Draft',Name='4TJI5',EffectiveDate=Date.Today(),AccountId=AccountList[0].Id);
  OrderList.add(Order_0);
  Order Order_1 = new Order(Pricebook2Id= pricebookId, Status='Draft',Name='0TXZU',EffectiveDate=Date.Today(),AccountId=AccountList[0].Id);
  OrderList.add(Order_1);
  insert OrderList;
 
  List<OrderItem> OrderItemList = new List<OrderItem>();
  OrderItem OrderItem_0 = new OrderItem(Product2id = p.id , PriceBookEntryId=standardPrice.Id, Description='FD3G8',OrderId=OrderList[0].Id);
  OrderItemList.add(OrderItem_0);
  OrderItem OrderItem_1 = new OrderItem( Product2id = p.id, PricebookEntryId=standardPrice.Id, Description='PB4DM',OrderId=OrderList[0].Id);
  OrderItemList.add(OrderItem_1);
  insert OrderItemList;

}

Would this help in my unit test , or is there a simpler test for OrderItem ?
Hi,
I am using a ternary operator like the following 
MyObject has a field "Name"



String WebSite = ‘Yahoo.com’;
String WebSiteResult = WebSite != null ? WebSite : ‘Google.com’;

But how can i do something like this 

MyObject obj = new MyObject();
String WebSite = ‘Yahoo.com’;
String WebSiteResult = WebSite != null ? { WebSite; obj.Name ='TestName' } : ‘Google.com’;
It says invalid '  {"

 
I have a class with the following layout 
if (testflag)
{
    //code 1
}
else
{
       //code 2
}
When i create a test for my trigger , I set the testflag to true hence it will fall in the code 1 section .
But my overall test dont give full 100% because the else condition is not met ?
Do i need to create another test that meets the else condition , because i dont want to create 2 test for my trigger  ?
thanks
 
I have a change trigger on  Account. I alos have a realtime triger on Account. If i run bothh tests then only one passes and i get an error for the second because if the change test has ran , then the realtime triggers and is expecting certain values which are not present.
Is there a way I can run each independently , so if I run a change for Account , ignore any other Account trigger and run just for that trigger test. 
Or can i run all test on an entity , regardless if change or realtime as one object ?
I have some custom objects that I create dynamically. Now I get an error saying that It failed to create the table (DUPLICATE_DEVELOPER_NAME) The object name is already in use.(fields:DeveloperName). 

I notice that under the Profile I cant see any tab to do with Custom Object Permission. 
How can I set this ?

Thanks
 
If i need to creat an Order , I need to first creat an Account and then assign the AccountId to the Order, like the following
 Account a = new Account();
 a.Name = 'Test';
 insert a;    

 Order order = new Order(     
        AccountId = a.Id,
        Status='Draft',
        EffectiveDate = Date.today());
 insert order;

Is there a way to create an Order and the required fields will be populated including the AccountId that is linked to the Account?
Reason is that I am looking at dynamically crating tests for my SObjects.
So if i have a trigger on Order (after insert) , I want to create a test for this but do it through a dynamic templating that I can use for al SObjects .

Thanks
I have a Salesforce project. I use SOAP API to login and that is successful. 
When our clients need to construct a query to a sObject they dont know all the field names, relationships etc . So they construct a very minimal query for lets say update / upsert .
What i am hoping to do is give them something like Query Builder Tool. 
So is there a way that I can add this to my Visual Studio project and display the UI to the user ?

Thanks
I am new to the Rest API wihin Salesforce and have a few queries.

1) With the Rest API ,do i need to create a connected app within my org before I can connect  and do all users use the same Secret Key ?  
2) What is required to implement OAuth authentication and do i need too ?
3) With the Rest API ,can i still use the SOQL or is there a better feature for  querying data ?
4) Can i query API endpoints and filter the response ?
5) Can i use the Rest Api to integrate data into Salesforce ?



Would one use the Rest API over Soap because SOAP requires downloading a WSDL file, Converting the WSDL files to regular classes and then invoking methods on those objects ?

Thanks
I have custom objects , say     My_Account__c, My_Contact__c , My_Address_c and others. 
I can successfully delete all custom objects , and then I go to run the empty recycle bin by using :

 public void EmptyRecycleBin(String[] ids)
        {
                EmptyRecycleBinResult[] result = _myservice.emptyRecycleBin(ids);
                for (int i = 0; i < result.Length; i++)
                {
                    EmptyRecycleBinResult result = emptyRecycleBinResults[i];
                }           
        }

I get a EmptyRecycleBinResult result of success, but when i go to the Create-Objects, I can see my custom object is deleted , but it remains in the Deleted Objects. I thought the EmptyRecyceBin would purge the objects in there , 
How can i permanently delete these custom objects ? 
I have a destructivechanges and package.xml file+

package.xm
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <version>51.0</version>
</Package>

Destructivechanges.xml

<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types>
        <members>myCustomObject__c</members>
        <name>CustomObject</name>
    </types>
</Package>


I have tried with the latest API Version and even though I have specified only 1 custom Object to delete, it actually deletes all of them and even the flag purgeondelete doesnt actually purge , I still have to manually delete the deleted objects, why is this ?
I have deleted a number of Objects and they have relationships and links. Is there an SOQL call or any other type of way i can make to clear these from the "Deleted Objects" instead of manually going and deleting them ?

I have a SOQL call as follows:
select Account.AccountNumber, Account.AccountSource, Account.Active__c, Account.AnnualRevenue, Account.BillingAddress,
Account.CreatedById, Account.CreatedDate, Account.CustomerPriority__c,
Account.Name, Account.NumberOfEmployees, Account.NumberofLocations__c, Account.OwnerId, Account.Ownership, 
 Account.Site, Account.SLA__c, Account.SLAExpirationDate__c, Account.SLASerialNumber__c,
 Account.SystemModstamp, Account.TickerSymbol, Account.Tradestyle, Account.Type, Account.UpsellOpportunity__c, 
   (select Sequence__c, Action__c from AcmeCo_Account_c__r where Processed__c = false and IDM__c = 'TEST1' ) 
from Account where Account.Id in (select Link__c from AcmeCo_Account__c where IDM__c = 'TEST1' and Processed__c = false) 

But it give an error:
(select Sequence__c, Action__c from AcmeCo_Account_c__r where Processed__c
                                    ^
ERROR at Row:17:Column:40
Didn't understand relationship 'AcmeCo_Account_c__r' in FROM part of query call. 
If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. 

The custom table is created . 
How can i avoid this or correct the query ?

thanks

 
I need to sign up a new Organization in Salesforce and do some development in .Net. But i want to know when a user signs up are they given a Production instance and SanbBox instance by default ? or is Production instance by default always given and the user has to set up a SandBox for testing ?
If i have lets say a Production , SandBox and Developer Edition in Salesforce. Is there a way I can login to one , probably Production and retrieve all instances registered to the Organisation. So logging into Production I can make some sort of ap[i call or apex call that will give me all instances assocaiated to this Organisation. (a link between Prod , Sandbox and Developer)
There is a rest call as follows;
GET /services/data/v40.0/tooling/query/?q=Select+id,SandboxName+from+SandboxInfo
But i am not using rest at the moment , only Soap , can i use an equivalent Soap call ?


Thanks
I have a change trigger on  Account. I alos have a realtime triger on Account. If i run bothh tests then only one passes and i get an error for the second because if the change test has ran , then the realtime triggers and is expecting certain values which are not present.
Is there a way I can run each independently , so if I run a change for Account , ignore any other Account trigger and run just for that trigger test. 
Or can i run all test on an entity , regardless if change or realtime as one object ?