Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BulkForceClient on nuget #246

Closed
avesse opened this issue Mar 7, 2017 · 6 comments
Closed

BulkForceClient on nuget #246

avesse opened this issue Mar 7, 2017 · 6 comments

Comments

@avesse
Copy link
Contributor

avesse commented Mar 7, 2017

We've got the latest version of the nuget package installed (1.3.2) but can't find the BulkForceClient in there. Is the nuget package out of date?

@avesse
Copy link
Contributor Author

avesse commented Mar 7, 2017

(Also couldn't find it with a search in the repo, so not sure what code the readme is referring to...?)

@mp3tobi
Copy link

mp3tobi commented Mar 20, 2017

It's at the moment only a beta version: https://www.nuget.org/packages/DeveloperForce.Force/1.4.0-beta
But I don't know how to install this beta via nuget. :(

@rdev5
Copy link

rdev5 commented Apr 14, 2017

I'm in the process of writing my own BulkForceClient as well.

Seems to be unimplemented in ForceToolkitForNet at this time as their JobInfo class only contains a fraction of what the actual documentation specifies: https://developer.salesforce.com/docs/atlas.en-us.api_asynch.meta/api_asynch/asynch_api_reference_jobinfo.htm

I'm essentially creating a class derived from ForceClient as a base class, "hiding" methods in base that I'm re-implementing using the new keyword and adding overloads to my own custom IBulkForceClient interface.

Example:

/// <summary>
/// Original JobInfo class extended to support creation of bulk upserts
/// 
/// Related:
/// - https://salesforce.stackexchange.com/a/14745
/// </summary>
[XmlRoot(Namespace = "http://www.force.com/2009/06/asyncapi/dataload",
    ElementName = "jobInfo",
    IsNullable = false)]
private class UpsertJobInfo
{
    [XmlElement(ElementName = "operation")]
    public string Operation { get; set; }

    [XmlElement(ElementName = "object")]
    public string Object { get; set; }

    [XmlElement(ElementName = "externalIdFieldName")]
    public string ExternalField { get; set; }

    [XmlElement(ElementName = "contentType")]
    public string ContentType { get; set; }

}

public async Task<JobInfoResult> CreateUpsertJobAsync(string objectName, string externalField, BulkConstants.OperationType operationType)
{
    if (string.IsNullOrEmpty(objectName)) throw new ArgumentNullException("objectName");

    var jobInfo = new UpsertJobInfo
    {
        ContentType = "XML",
        Object = objectName,
        ExternalField = externalField,
        Operation = operationType.Value()
    };

    return await _xmlHttpClient.HttpPostAsync<JobInfoResult>(jobInfo, "/services/async/{0}/job");
}

Will keep you posted on how it goes :)

@rdev5
Copy link

rdev5 commented Apr 14, 2017

For now at least...I'm able to create batch upsert jobs, specifying which field will be my externalIdFieldName.

The primary "enabler" for being able to create this was to expose _xmlHttpClient and _jsonHttpClient as protected in ForceClient.cs here so this new BulkForceClient class could pass it its own instance of UpsertJobInfo containing the new externalIdFieldName field.

PR submitted: #248

@cemerson
Copy link

cemerson commented May 2, 2018

Are we sure BulkConstants is in 1.4.0-beta? I've got that installed in my project but can't find/use BulkConstants, CreateJobAsync etc. However if I clone the latest master branch from github and reference it that way in my project i DO see it. Unfortunately for some reason when I reference the full code/branch this way my web app hangs on any Salesforce connection then so I can't use this method for now. Which is why I'm trying to find out how/if we can get BulkConstants via nuget right now or not.

@wadewegner
Copy link
Owner

If this is still an issue (see latest updates to code) please re-open with more specifics.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants