Link is not creating

even if I got fromnode,tonode,fromport,toport in “linkDrawn” event handler ,it is enough after that I can proceed with my logic

i got some event data in “linkDrawn” eventhandler, there is node data with that other than gohashid

and i tried this to

model.linkFromKeyProperty = (linkData: LinkData, oldKey?: go.Key) => {
        `if (oldKey) return oldKey`
        return linkData.link.outputPort.uid
      }
      model.linkToKeyProperty = (linkData: LinkData, oldKey?: go.Key) => {
       `if (oldKey) return oldKey`
        return linkData.link.inputPort.uid
      }
      model.linkFromPortIdProperty = (linkVal: LinkData, oldProp?: string) => {
        `if (oldProp) return oldProp`
        return linkVal.link.outputPort.portIndex.toString()
      }
      model.linkToPortIdProperty = (linkVal: LinkData, oldProp?: string) => {
        `if (oldProp) return oldProp`
        return linkVal.link.inputPort.portIndex.toString()
      }

The model has to be able to modify the link data object so that it connects the intended nodes and ports. You have to make sure all link data objects have the structure that you want.

If you do not follow my instructions, given above, the user will not be able to draw new links.

localDig.toolManager.linkingTool.archetypeLinkData = {
      link: {
        inputPort: {
          uid: "tokey",
          portIndex: "0"
        },
        outputPort: {
          uid: "fromkey",
          portIndex: "0"
        }
      }
    }

after adding this the link is creating, but it does not honor the linkTemplate , and i need to restrict that linking, i want make the programatically in event handler

Good, that is the first step towards supporting your custom data schema. The second step is required – setting GraphLinksModel.copyLinkDataFunction on each model.

Have you defined “Default” as a Iink template by modifying Diagram | GoJS API ?

no, I have “Default” type link I’ll change that