I have installed Courier 2.5 on Umbraco 4.7.1 and Umbraco Relations created through the Back Office are not transferring.
Our site is heavily dependent upon Umbraco Relations so I have built a series of Data Types in the Back Office that create Relations through the Relations API, these relations are then exposed through the front-end web pages. When I deploy a content item using the right click method via Courier all values are transferred fine, except the Relations.
I'm wondering if there is something I am doing wrong or have configured incorrectly.
You need to add the type of relations you wish to transfer to the /config/courier.config file, as it only transfers the ones you specificly asks it to.
Thanks, that worked beautifully. One thing though is that Courier appears to transfer "added" relations, but not "removed" relations. Is this something that is not supported? If so, could you suggest a possible workaround?
I haven't user Document.Copy yet. I've been creating relations through the Back Office using the Relations API. I've written the following generic method to do so. Have you checked to make sure that the Relations are indeed being created in the relations table?
public void addRelations(int parentId, string relTypeAlias, List<int> childIds, bool overwrite) { int numRelationsAdded = 0; int numRelationsRemoved = 0;
Node m_parentNode = new Node(parentId); string m_parentName = m_parentNode.Name;
// Delete relations that may have been removed by this action foreach (Relation r in Relation.GetRelationsAsList(parentId)) { if (r.RelType.Alias == relTypeAlias) { int m_childId = r.Child.Id; Node m_childNode = new Node(m_childId); string m_childName = m_childNode.Name;
if (!childIds.Contains(m_childId) || overwrite) { r.Delete(); numRelationsRemoved++; } } }
// Add relations specified by this action foreach (int m_childId in childIds) { Node m_childNode = new Node(m_childId); string m_childName = m_childNode.Name;
I also touched the web.config to ensure that the site re-compiled. Yet, when I deploy a content document that I know has a 'relateDocumentOnCopy' relation to another document the relation is not transfered.
Courier 2.5 and Umbraco Relations
I have installed Courier 2.5 on Umbraco 4.7.1 and Umbraco Relations created through the Back Office are not transferring.
Our site is heavily dependent upon Umbraco Relations so I have built a series of Data Types in the Back Office that create Relations through the Relations API, these relations are then exposed through the front-end web pages. When I deploy a content item using the right click method via Courier all values are transferred fine, except the Relations.
I'm wondering if there is something I am doing wrong or have configured incorrectly.
Hi Peter
You need to add the type of relations you wish to transfer to the /config/courier.config file, as it only transfers the ones you specificly asks it to.
Hi Per,
I have exactly the same problem.
In which section of the config file do we need to add the type of the relations?
Per,
Thanks, that worked beautifully. One thing though is that Courier appears to transfer "added" relations, but not "removed" relations. Is this something that is not supported? If so, could you suggest a possible workaround?
Thank you again
Sergio,
At the very bottom of the /config/courier.config file there is a node <relations>, you add the child nodes within that node. Like this.
<relations>
<add>myRelationType</add>
</relations>
I create the relations with the API. Exactly with this code:
Document docCopy = docCastellano.Copy(idParentSource, author, true);
I have checked the Courier.config and I have the default configuration which it´s:
<relations>
<add>relateOnCopy</add>
<!-- <add></add> -->
</relations>
But the related nodes are not migrated when I deploy a source node. What am I missing?
Sergio,
I haven't user Document.Copy yet. I've been creating relations through the Back Office using the Relations API. I've written the following generic method to do so. Have you checked to make sure that the Relations are indeed being created in the relations table?
public void addRelations(int parentId, string relTypeAlias, List<int> childIds, bool overwrite)
{
int numRelationsAdded = 0;
int numRelationsRemoved = 0;
Node m_parentNode = new Node(parentId);
string m_parentName = m_parentNode.Name;
// Delete relations that may have been removed by this action
foreach (Relation r in Relation.GetRelationsAsList(parentId))
{
if (r.RelType.Alias == relTypeAlias)
{
int m_childId = r.Child.Id;
Node m_childNode = new Node(m_childId);
string m_childName = m_childNode.Name;
if (!childIds.Contains(m_childId) || overwrite)
{
r.Delete();
numRelationsRemoved++;
}
}
}
// Add relations specified by this action
foreach (int m_childId in childIds)
{
Node m_childNode = new Node(m_childId);
string m_childName = m_childNode.Name;
string m_comment = "Relating " + m_parentName + " to " + m_childName + ".";
if (!Relation.IsRelated(parentId, m_childId))
{
RelationType rt = RelationType.GetByAlias(relTypeAlias);
Relation.MakeNew(parentId, m_childId, rt, m_comment);
numRelationsAdded++;
}
}
}
Hi Peter,
I have checked the relations table and it´s filled when you use the Document.Copy method.
This is an example:
Id ParentID childID relType datetime comment
45781 66364 66365 1 2012-01-10 12:17:46.853
Checking in the UmbracoRelationType table, this is the type which it uses the method:
1 1 C66BA18E-EAF3-4CFF-8A22-41B16D66A972 C66BA18E-EAF3-4CFF-8A22-41B16D66A972 Relate Document On Copy relateDocumentOnCopy
So, I have updated the Courier.config with this relation type and now it works perfectly.
Thanks for give me the trail!!!
I'm having the same problem Peter had. I am running Umbraco 4.7.0 with Courier 2.6. I have updated my courier.config file with this:
<relations>
<add>relateDocumentOnCopy</add>
</relations>
I also touched the web.config to ensure that the site re-compiled. Yet, when I deploy a content document that I know has a 'relateDocumentOnCopy' relation to another document the relation is not transfered.
What am I missing?
I removed all comments from courier.config and "magically" relations are now being transferred properly. Go figure.
is working on a reply...