2 Replies Latest reply on Mar 24, 2015 9:29 AM by dlezell

    Using a collection in a Copy Rule

    dlezell Rookie

      I am attempting to set up a copy rule so that when a user creates a request, their associated Agency is populated on the Request window. There is a collection on the User object for the Agency that the user is associated with. I created a one-to-one relationship for the Agency on the Request object, then setup a copy rule that targets the _Agency attribute on the Request object and uses it's source as the RaiseUser/_AgencyCol (this is the Agency collection on the User object). When I test the window, I get the following error "Type mismatch when attempting to set attribute value _Agency"


      Is it possible to create a copy rule that uses a collection as the source?

        • 1. Re: Using a collection in a Copy Rule
          plazz Apprentice

          Since you are copying a collection field to a 1-1 relationship field I would expect a type mismatch. I don't know if it is possible but you can try to copy the title and create a string field on request so your types match. It might be that the system takes the first or last item in the collection. If it doesn't work you can try a calculation instead of a copy rule where you can take the first or last item out of a collection (or another one if you want) One question I have though... Why do you have a collection on the user object? If a user can belong to multiple agencies... how do you know which one to use on the request? If he can only belong to 1 agency at a time, I would adcise to create a 1-1 relationship on the user object. That will also solve your copy rule problem.

          1 of 1 people found this helpful
          • 2. Re: Using a collection in a Copy Rule
            dlezell Rookie

            Great points. A calculation sounds like it could work here, but this was solved by rebuilding the Agency object as a reference object, then creating a filter on the window that only displays Agencies who the user is a member of. This way, if a user is a member of only one agency, it is automatically selected, otherwise they select from an agency drop-down that displays each agency they belong to. I was complicating things by using a standard business object as Agency and trying to have a copy rule run with a collection as it's source. Probably possible using a calculation like you state, but not necessary in this case. Thanks.

            1 of 1 people found this helpful