Coder Social home page Coder Social logo

Getting CustomFields about infusionsoft.net HOT 7 CLOSED

eventday avatar eventday commented on July 22, 2024
Getting CustomFields

from infusionsoft.net.

Comments (7)

simonlongson avatar simonlongson commented on July 22, 2024

For now what I'm doing is adding in the custom fields into the contact.cs structure

[XmlRpcMember("_Status")]
[Access(Access.Edit | Access.Delete | Access.Add | Access.Read)]
public string _Status { get; set; }

This is a fix but I'd rather not clog up the Contact.cs file with all these extra fields, especially as I'm not able to get into IS to check field types, making this a very labour intensive job (adding field checking it works and changing type if not, for 30+ fields).

from infusionsoft.net.

simonlongson avatar simonlongson commented on July 22, 2024
[XmlRpcMember("_Status")]
[Access(Access.Edit | Access.Delete | Access.Add | Access.Read)]
public dynamic _Status { get; set; }

seems to work so I'll just continue down that route. Hopefully this will help someone else out.

Would still like to know if there's a built in way to read the custom fields though. Cheers

from infusionsoft.net.

scottcate avatar scottcate commented on July 22, 2024

There are extention methods in the projection for Custom Fields. use IncludeCustomField(string fieldName)

The sample Shows p.Include(c => c.Id)

I think you can add p.IncludeCustomField("status") to the projection, and you'll get that custom field back.

from infusionsoft.net.

scottcate avatar scottcate commented on July 22, 2024

The Contact Table inherits from an abstract class Table, which has a property of CustomFields, you're value should be in there waiting for you. Is it not?

public IDictionary<string, object> CustomFields
{
    get { return _customFields; }
}

from infusionsoft.net.

simonlongson avatar simonlongson commented on July 22, 2024

Yeah I'm using the following from that sample.

//Find contact vanilla api style
var contacts2 = client.ContactService.FindByEmail(email, new[] {"Id", "Email"});

I'm getting the custom fields back in the xml but I didn't know how to call them in the code. I'm guessing they don't get added to the customFields dictionary unless used the way you've pointed out though. Thank you I'll look into that

from infusionsoft.net.

scottcate avatar scottcate commented on July 22, 2024

That's right, the CustomFields projection adds them correctly on the return payload, where the string[] ignores the unknown fields. So they're coming back, they just don't have a home.

Enjoy the project!

from infusionsoft.net.

simonlongson avatar simonlongson commented on July 22, 2024

Perfect thank you. Will do. It's been a live saver so far :-)

from infusionsoft.net.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.